MATLAB: Insertshape auto find the coordinate of the object

Computer Vision ToolboxImage Processing Toolboximage segmentationinserthape

Hi, may i know how to insertshape auto find the coordinate of the object that in black pixel in the image?
Capture.JPG

Best Answer

info = regionprops(~TheImage, 'Centroid');
coords = vertcat(info.Centroid);
x_coords = coords(:,1);
y_coords = coords(:,2);
but remember that x corresponds to columns and y corresponds to rows.
Related Question