Hi
I am new to Image processing. I have edge detected image,it have two circles.
I have to find the center and radius of two concentric circles.
I choose the hough transform for that detection. For proceeding hough transform i should know the two or three points that lies on the circumference of circle from edge detected image.but i don't know how to take points from edge detected image.
Please guide me....
Hough Transform
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Hough Transform
Suppose you have a white circle on a black background. You want to find three points on the circle. Windows script; adjust for other languages.
Three points are at (337,525), (360,526), (315,528).
For best accuracy, you might do this twice. The first time gets an approximate centre and radius, which gives a better guess for the radius of the red circles.
Code: Select all
%IM%convert -size 1000x1000 xc:Black ^
-fill None -stroke White ^
-draw "circle 345,665 485,665" ^
test.png
rem Find a white pixel
%IM%compare -metric RMSE test.png xc:White -subimage-search Null:
rem Result is 0 (0) @ 337,525
rem Overwrite this and other nearby white pixels.
%IM%convert test.png ^
-fill Red -stroke Red ^
-draw "circle 337,525 357,525" ^
test.png
rem Find another white pixel
%IM%compare -metric RMSE test.png xc:White -subimage-search Null:
rem Result is 0 (0) @ 360,526
rem Overwrite this and other nearby white pixels.
%IM%convert test.png ^
-fill Red -stroke Red ^
-draw "circle 360,526 380,526" ^
test.png
rem Find another white pixel
%IM%compare -metric RMSE test.png xc:White -subimage-search Null:
rem Result is 0 (0) @ 315,528
For best accuracy, you might do this twice. The first time gets an approximate centre and radius, which gives a better guess for the radius of the red circles.
snibgo's IM pages: im.snibgo.com
Re: Hough Transform
Thanks for your reply...
But how do you find the three points [ (337,525), (360,526), (315,528)].
Only i have black edges(circles) on white background,i don't know the any parameters of circles.
I have only image with pixel value is 0 for edges(circles) and 255 for white background,from that how can i take points on edges.
Could you please explain me....
But how do you find the three points [ (337,525), (360,526), (315,528)].
Only i have black edges(circles) on white background,i don't know the any parameters of circles.
I have only image with pixel value is 0 for edges(circles) and 255 for white background,from that how can i take points on edges.
Could you please explain me....
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Hough Transform
If you have black circles on a white background, use "-negate".
The compare command gives each coordinate. Your script needs to read this.
The compare command gives each coordinate. Your script needs to read this.
snibgo's IM pages: im.snibgo.com
Re: Hough Transform
Thanks for your reply...
I don't have any prior knowledge in mat lab. I want to develop my code in c language.
could you please explain the logic to find points on edge...
I don't have any prior knowledge in mat lab. I want to develop my code in c language.
could you please explain the logic to find points on edge...
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Hough Transform
I don't understand your question.
You can convert a file to ppm format ...
... and the result is text values for the pixels. A program in C can very easily and quickly read this file to find pixels that are black, white or anything else.
You can convert a file to ppm format ...
Code: Select all
convert x.png -compress None x.ppm
snibgo's IM pages: im.snibgo.com
-
- Posts: 3
- Joined: 2013-10-17T09:38:51-07:00
- Authentication code: 6789
Re: Hough Transform
OT, but I thought IM didn't have a Hough Transform.
Is there a way to create a HT in IM? Or are their programs that are available for a HT via use of IM?
-- Owen
Is there a way to create a HT in IM? Or are their programs that are available for a HT via use of IM?
-- Owen
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Hough Transform
IM does not currently have Hough Transforms as far as I know. Snibgo was showing you how to calculate an ellipse shape by picking a few points, if I understand what he is doing.
If you want Hough Transforms, perhaps see OpenCV
If you want Hough Transforms, perhaps see OpenCV