Size mismatch error using regionprops in Simulink matlab function block

조회 수: 4 (최근 30일)
Andrew Poissant
Andrew Poissant 2018년 7월 10일
편집: Andrew Poissant 2018년 7월 10일
I am trying to use matlab's regionprop function in a matlab function block in Simulink. In the function block, I have a 47 x 52 binary image (BW) and I want to use regionprops to extract various properties. Below is my code to extract the centroids of the binary image. When I run the simulink model I get the following error:
"Size mismatch for MATLAB expression 'regionprops'. Expected = 1x1 Actual = 7x1"
I suspect this is because I have 7 different centroids, but I am unsure of how to get around this error.
coder.extrinsic('regionprops')
s_centroid = struct('centroid', zeros(2,1));
s_centroid = regionprops(BW, 'centroid');
centroid = s_centroid.centroid

답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by