필터 지우기
필터 지우기

Pass an image to a function from C#

조회 수: 5 (최근 30일)
Ron Schoenberg
Ron Schoenberg 2015년 11월 5일
답변: Subhra Saha 2015년 11월 9일
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!

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by