Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
find object using centroid information

Subject: find object using centroid information

From: imagevision

Date: 29 Sep, 2011 11:01:13

Message: 1 of 1

Hallo everybody,

I want to do opposite of what is going on in 1 and 2.
In 1 and 2, regionprops gives centroids which are plotted on the corresponding objects as *.
What i have is centroid coordinates and want to get the corresponding object?
So my question is how i can get a corresponding object (label object) using centroid information.

Thank in advance.
from
Image vision.


1)
BW = imread('text.png');
   s = regionprops(BW, 'centroid');
   centroids = cat(1, s.Centroid);
   imshow(BW)
   hold on
   plot(centroids(:,1), centroids(:,2), 'b*')
   hold off

or
2)
L = bwlabel(I);
s = regionprops(L, 'Centroid');
hold on
for k = 1:numel(s)
    plot(s(k).Centroid(1), s(k).Centroid(2), 'r*')
end
hold off

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us