Pass an image to a function from C#

2 Ansichten (letzte 30 Tage)
Ron Schoenberg
Ron Schoenberg am 5 Nov. 2015
Beantwortet: Subhra Saha am 9 Nov. 2015
I'm preparing the C# portion of my project and am trying to set up an environment in C# which allows me to pass an image to a matlab function, let matlab do its job, and return a boolean or integer representation of the boolean. So in short, the return value isn't anything special and works fine, but the argument causes troubles. Now matlab functions happily take images and any other formats as arguments, but C# seems to only be able to pass strings or atomic values. So when I try to pass a bitmap as a parameter, I get:
"The file name or URL argument must be a string."
As an error message. And yes, it remains the same error message when I pass the path of the image. So it's not really the matlab side causing the problem. I'm using visual studio 2015 and matlab version 2015b, and they seem to cooperate nicely when I'm passing simple variables and returning simple variables. The function call is defined as this:
matlab.Feval("testFile", 2, out result, path);
If anyone has any idea your help would be greatly appreciated!

Antworten (1)

Subhra Saha
Subhra Saha am 9 Nov. 2015
Hi Ron,
To pass an image from C# to MATLAB function, you can use MWArrays as mentioned in the following link:

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by