When I'm trying to transform my Matlab code to C, this error appeared yet I don't know how to modify it as it necessary in my function.
%% Remove small objects.binaryImage = imclearborder(binaryImage);binaryImage = bwareaopen(binaryImage, 100);%% Invert the binarized image% binaryImage = ~ binaryImage;%% Get centroid on imagestats = regionprops(binaryImage, 'Centroid'); % acting on the cleaned imagecentroids = cat(1, stats.Centroid);x1 = centroids(1,1);y1 = centroids(1,2);x3 = centroids(3,1);y3 = centroids(3,2);
The error " Directly accessing field or property of nonscalar struct or object not supported for code generation" showed at
centroids = cat(1, stats.Centroid);
How I can resolved it as it is necessary for my function.