Generating mex file from Matlab code containing regionprops
Ältere Kommentare anzeigen
I'm trying to generate a mex file from Matlab code without much success.
The function I want to compile calls the function regionprops from the Image Processing Toolbox. Since this function is not supported by Matlab Coder, I am declaring it as extrinsic. My problem is declaring the output of regionprops. The output is a vector of structures with a single field of type double and variable size (1D vector always). An example of my code follows:
function outVar = MyFunction( img ) %#codegen
coder.extrinsic( 'regionprops' );
% Some kind of declaration for properties should be added here %
properties = regionprops( img, 'PixelIdxList' );
outVar = 0;
for i = 1:length( properties )
outVar = outVar + properties(i).PixelIdxList( end );
end
The question is, how to declare the variable "properties" and what kind of flags to use during compilation so that a structure with a variable sized field can be compiled.
Any help is greatly appreciated.
Michael.
2 Kommentare
Ashish Uthama
am 12 Jun. 2012
could you say more about the full application? Why not write a function which interfaces with regionprops and declare that function extrinsic?
Michael
am 13 Jun. 2012
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Region and Image Properties finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!