Size mismatch error using regionprops in Simulink matlab function block
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!