wow, it works :o here's the code for those who want it: image = imread('shit.jpg'); img = im2bw(image); imshow(img); [label num] = bwlabel(img, 8); graindata = regionprops(label, 'all'); for i = 1:num if graindata(i).Eccentricity < 0.2 found = i; area = graindata(found).Area radius=sqrt(area/pi); radius=1.2*radius; centroid = graindata(found).Centroid; t= 0:pi/20:2*pi; x=centroid(1)+radius*cos(t); y=centroid(2)+radius*sin(t); hold on; plot(x,y); end end
I'm checking the code, its interesting. I don't know how exactly this part works: x = centroid(1)*radious*cos(t); y = centroid(2)*radious*sin(t);.... it seems we need to identify the centroid first and start to draw the circle, but, here you are multipliying the centroid... how was that?
Sir . . i tried the code which gets displayed here ..but it didint work ...wht is img8? i did create shapes.jpg but error occured ... cn u guide me plz !!!
tip: replace img = im2bw(img); with img = im2bw(image); and you can keep original image with detection. Thank you very much! Really good code!
MrCockerrr 1 month ago
MrCockerrr 1 month ago
the link is not working
Girimurali 2 months ago
I just click on 'full screen'.. its a + no a * ... now all is clear.. thank you so much
wensirui 3 months ago
I'm checking the code, its interesting. I don't know how exactly this part works: x = centroid(1)*radious*cos(t); y = centroid(2)*radious*sin(t);.... it seems we need to identify the centroid first and start to draw the circle, but, here you are multipliying the centroid... how was that?
wensirui 3 months ago
What the hell ? Where is the circle detection ?
discoguru 9 months ago
Sir . . i tried the code which gets displayed here ..but it didint work ...wht is img8? i did create shapes.jpg but error occured ... cn u guide me plz !!!
sabjee100 1 year ago
can you show me the code please? thanks
Andren2007 1 year ago
This has been flagged as spam show
wow... it worked for me...
aviyanka070 2 years ago