Ask Your Question
1

about houghcircles

asked 2015-10-16 21:05:58 -0500

widgetman gravatar image

if its gauranteed youll always have a single large blob and nothing else in a binary image, can you use houghcircles to determine how much like a circle that 1 large blob is? what would be the best parameters to use with houghcircles if so?

edit retag flag offensive close merge delete

Comments

I don't think it is the appropiate function (I'm not even sure it will work at all if the blob is too different). To determine how much like a circle your contour is, you'd better use shape descriptors like compactness, elongation, convexity, moments, etc.

LorenaGdL gravatar imageLorenaGdL ( 2015-10-17 08:47:50 -0500 )edit

1 answer

Sort by » oldest newest most voted
3

answered 2015-10-17 10:47:31 -0500

updated 2015-10-17 11:13:16 -0500

I agree with LorenaGdL:

I don't think it is the appropiate function (I'm not even sure it will work at all if the blob is too different). To determine how much like a circle your contour is, you'd better use shape descriptors like compactness, elongation, convexity, moments, etc.

Take a look at this tutorial:

http://opencv-code.com/tutorials/dete...

Given some contours, the program approximate a polygonal curve for that contours. This polygonal curve is the key for detecting the contour’s shape.

A contour is a circle if:

  • Has more than 6 vertices.
  • Has diameter of the same size in each direction.
  • The area of the contour is ~πr2

I have modified this tutorial in order to add a pre-processing step in order to build a robust algorithm to deal with different illumination conditions [1]. Afterwards, I run several times the canny detector with different parameters. The last step to detect all contours is to put together the same contours (two contours are the same contour is their center of mass is the same: the euclidean distance between the center of gravity is less than 1/2/3/4/ pixels depending on the size of the image).

[1] you can use this preprocessing algorithm https://github.com/bytefish/opencv/bl... or even, you can use histogram equalization, or CLAHE (http://answers.opencv.org/question/12...)

You can see the results I get:

image description image description

edit flag offensive delete link more

Comments

Well, how many rods are there?

Throwaway99 gravatar imageThrowaway99 ( 2015-10-19 17:46:08 -0500 )edit

~ 300/350 .

albertofernandez gravatar imagealbertofernandez ( 2015-10-20 05:20:57 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-10-16 21:05:58 -0500

Seen: 237 times

Last updated: Oct 17 '15