i want to find centroid of the detected object in a image ..How to do that ?image is attached here

7 views (last 30 days)
i have done segmentation now i want find centroid of the detected object ,how i will do it using regionprops

Accepted Answer

Image Analyst
Image Analyst on 2 Feb 2019
You can use regionprops
props = regionprops(binaryImage, 'Centroid');
allCentroidsXY = vertcat(props.Centroid);
See my Image Processing Tutorial in my File Exchange for a full demo.
  2 Comments
amina khan
amina khan on 4 Feb 2019
Moved: DGM on 14 Feb 2023
thankyou for quick reply !i have find out the centroids, now i have to take the centroid of one object(a) of image and map this with other centroids of objects of second image .i want to use the first object(a) centroid as mask and want to apply on second image objects ,objects are actually cancer cells .i want to take same color variations in my created image by using this mask object .please guide how i will use te centroids .
amina khan
amina khan on 4 Feb 2019
Moved: DGM on 14 Feb 2023
first image is segmented image ,i take the centroid of one object ,i use label ==29 ,its a 29th object ,in second image ,now i want to mapp this single centroid on all the objects in 3rd image .how i will do this please help me ,i have tried but did get the required output.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 2 Feb 2019
If you pass regionprops a logical array as the first parameter and request 'centroid' then it will return a structure array in which there is one centroid for each of those white blobs.
If you pass regionprops an array of any other numeric data type as the first parameter, and request 'centroid', then it will return a scalar structure in which the only centroid is for the all of the white blobs considered as if they form a single object.

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!