how to convert MATLAB code to c code for a functions which is using a string as a parameters?

HI!
Firstly, I'm really surprised Mathwork's fast update for Image Processing Toolbox functions for MATLAB code generator. It's pretty awesome.
Now I'm in big trouble on code generator......
When i try to use morphological filters ( like imopen, imdelation, imelode... ), we use 'strel' function to make elements
and I'm trying to convert strel function on matlab to c code
but the code generator said "All inputs must be constant."
because input parameter of strel function is string which means type of element
I think this string causes this error......
.
how can i solve this problem????
plz help me
thx

댓글 수: 1

Is the radius of your strel function a constant value, or is it a variable?
In my experience with Coder, the app will correctly generate code if the arguments to strel are constants. Moreover, your structuring element must also be a constant in order for it to be used by the morphological functions (imopen, etc.).
So while this should work:
X = strel('disk', 5);
This will not:
X = strel(sStrelType, dStrelSize);
If you need variable-sized structuring elements, this can be a real pain, because you can't even make arrays of strels. I worked around those limitations by constructing several constant structuring elements and then using them in separate imtophat calls in the case branches of a switch statement. Very unpretty, but it works.

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

답변 (0개)

질문:

2015년 11월 13일

댓글:

2016년 2월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by