MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Opportunities for recent engineering grads.
New to MATLAB?
How to find out the image center and its x,y co-ordinate with out using [x,y]=ginput(n) matlab command?
How to import these data into matlab work space?
EX. image http://img839.imageshack.us/img839/2002/bull1.jpg
Direct link to this comment:
Direct link to this answer:
imfill(), then regionprops() the Centroid
>> hold off
Actually i got image like http://imageshack.us/photo/my-images/856/bulls11.jpg/ this.
How to get the four concentric circles x,y data?
Why are you plotting centroid(:,1) against itself?
Is there any reason to expect that the centroids of the four circles will be in different locations rather than all at the same place ?
Don't forget to threshold your image, or else you are going to get a centroid for each distinct non-zero gray-level.
Sir here i did thresh,im2bw,imfill and finally i got this image.
My only application is finding out the width of the circle by single mouse click only ,up to now whatever you suggested is more than two mouse pointer clicks.
for the above link circle if we find out the width in pixel using only one click almost my application will be completed so please guide me.
Not me. I suggested the no-mouse-click version that finds all of the information at the same time. I also showed how to select the information for a single one out of that: namely, use label the binary image, regionprops() the information out, then use ginput() on the original image to select a point, look up that point in the label image to find the index into the regionprops struct() information, return the appropriate result.
You need to invert that image. The foreground has to be white, not black.
FYI, in the duplicate question here, Naresh first asked for a method using ginput(). Walter suggested an automated way using regionprops(), but then Naresh again asked for a manual method using ginput(), which I gave. Now I guess Naresh is willing to consider the automatic method again, for which code is in the first question. An example of finding centroids of round objects (coins, not rings) can be found in BlobsDemo image segmentation tutorial in my File Exchange.