[EDIT: Fri May 13 20:58:34 UTC 2011 – Reformat – MKF]
I want to find the x n y coordinates and pixel value of the centroid. Here is the code I have:
I = imread('mobil.png');%I2 = imtophat(I,strel('disk',15));
level = graythresh(I);bw = im2bw(I,level);I2 = 1 - bw;I2 = bwareaopen(I2, 200);I3 = imfill(I2, 'holes');s = regionprops(I3, 'centroid');centroids = cat(1, s.Centroid);imshow(I3)hold onplot(centroids(:,1), centroids(:,2), 'b*')hold offimpixelinfo
The car is :
Best Answer