필터 지우기
필터 지우기

How do I specify parameter types (specifically Image types) of a function in a .NET assembly created by MATLAB?

조회 수: 1 (최근 30일)
Hi everyone!
I have the following code in a MATLAB function;
function [ returnValue] = ProcessImage( passedImage )
originalImage = imread(passedImage);
[rowSize colSize] = size(originalImage);
returnValue = colSize
end
I built a .NET assembly with this bit of code. I then added it as a reference to a C#.NET application. I now need to pass an image from the .NET application this bit of code, which will process the image and return its column size.
I'm not sure how to go about the type setting. Cuz when I try it out, a syntax error is shown in Visual Studio saying that the argument expected is of type int.
Have I written the MATLAB function declaration correctly?
  댓글 수: 4
Geoff Hayes
Geoff Hayes 2014년 6월 28일
So is the C# application that doesn't' like the return value from ProcessImage? If that is the case, then cast colSize as an integer
returnValue = int32(colSize);
The above is for a 32-bit signed integer. If something different is needed, then cast as appropriate.
Lahiru
Lahiru 2014년 6월 28일
This is just a sample code I posted here. In my actual code I take in a string (imagePath - after your suggestion) and return a string. However, in VS2012, both the input params and the return values type is detected as int.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by