From: marlina on
Hi everyone,

Region centroid code:

L = bwlabel(Iedge);
ZB1 = regionprops(L, 'Centroid'); %acquire the center of mass
center_x = ZB1.Centroid(1); %acquire X position of the center mass
center_y = ZB1.Centroid(2); %acquire Y position of the center mass

Let say the answer for center_x=211
center_y=296

So, how I am going to plot (* with red color) the coordinate of the centroid into the original image (Iedge)?

Thank you
Marlina
From: Walter Roberson on
marlina wrote:

> Region centroid code:
>
> L = bwlabel(Iedge); ZB1 = regionprops(L, 'Centroid'); %acquire the
> center of mass
> center_x = ZB1.Centroid(1); %acquire X position of the center mass
> center_y = ZB1.Centroid(2); %acquire Y position of the center mass
>
> Let say the answer for center_x=211
> center_y=296
>
> So, how I am going to plot (* with red color) the coordinate of the
> centroid into the original image (Iedge)?

line(center_x, center_y, 'Marker', '*', 'MarkerEdgeColor', 'r')