Just for curiosity and to learn something new I am using contours to find circles in image.
This is my approach.
1. First I find edges by:
cvThreshold( img_8uc1, img_edge, thresh, 255, CV_THRESH_BINARY );
where thresh changes from 200 down to 20.
I repeat the whole procedure for every value of thresh
2. I look for contours:
cvFindContours( img_edge, storage, (CvSeq**)&chain, sizeof(CvChain), CV_RETR_LIST, CV_CHAIN_CODE );
3. Then I accumulate Freeman chain codes by their values.
For circles I expect to get similiar amounts for Freeman directions:
0 and 2 and 4 and 6
1 and 3 and 5 and 7
and it works fine in most cases.
Problem is that for some contour shapes it doesn't.
So the question is:
How can I find circles by analysing contours using OpenCV?
Thank you :-)