# Revision history [back]

### findCircleGrid detection, how to debug?

Hello!

First of all - I am using opencv 2.4.10 on Ubuntu 14.04 (amd64), built from sources. I use python binding for my tests.

I am calibrating camera using circles grid (symmetric) and then looking for the same circle grid pattern to calculating distance. Usually I use 5x3/6x4 pattern, total dimensions of pattern from A4 paper up to 1m x 1m sized. Camera is 1/2.7 CMOS IPcam (so, I am catching h.264 stream yuv420, not any kind of row data, bitrate from 3 up to 20 mbits, so no bugs on image) resolution is 1920x1080. Lenses are about 2mm focus and 6mm focus.

I have found next problem, opencv can not detect pattern when I see on image ceil of one of my office rooms (I have different cases somewhere it is detecting very well, somewhere it is not detecting at all). Ceil is like grid of squares (later today, I can attach images to this thread). I have spent a few hours understanding, why previously good detection doesnt work.

I have looked into sources of findCirclesGrid:

• findCirclesGrid itself placed in modules/calib3d/src/calibinit.cpp
• All related functions are in modules/calib3d/src/circlesgrid.cpp

So, I want to understand how findCirclesGrid works and find out some ways to debug and improve it. I dont think I can improve it generally, but I can use such tricks, as tuning parameters for my pattern or add some pre detection of area where pattern is placed and then execute findCirclesGrid only for subarea of total image.

Quesitons:

1. circlesgrid.cpp has #ifdef DEBUG_CIRCLES, if turn it on, it produce 1 warning and 3 errors, but them easily can be fixed. I turned it on, rebuilt opencv, but cant see any difference, maybe it debug some logic, that is not used in my case. What is DEBUG_CIRCLES for?

2. There are CirclesGridFinderParameters parameters. What are they for? I think it is possible to add another option for findCirclesGrid and set different values.

3. There is const Ptr<featuredetector> &blobDetector option for findCirclesGrid. What is it for? What is possible values? As I listened somewhere before, It uses SimpleBlobDetector, but how "good" is it? Are there other blob detectors in opencv?

4. Where I can learn how circle grid finder works, except the sources?

5. Is it possible to see any debug info? For example all circles, that method have found and so on, to better understand, why it cant recognize pattern.

And I would be happy to learn any other your ideas about described above. Thanks!

### findCircleGrid detection, how to debug?

Hello!

First of all - I am using opencv 2.4.10 on Ubuntu 14.04 (amd64), built from sources. I use python binding for my tests.

I am calibrating camera using circles grid (symmetric) and then looking for the same circle grid pattern to calculating distance. Usually I use 5x3/6x4 pattern, total dimensions of pattern from A4 paper up to 1m x 1m sized. Camera is 1/2.7 CMOS IPcam (so, I am catching h.264 stream yuv420, not any kind of row data, bitrate from 3 up to 20 mbits, so no bugs on image) resolution is 1920x1080. Lenses are about 2mm focus and 6mm focus.

I have found next problem, opencv can not detect pattern when I see on image ceil of one of my office rooms (I have different cases somewhere it is detecting very well, somewhere it is not detecting at all). Ceil is like grid of squares (later today, I can attach images to this thread). I have spent a few hours understanding, why previously good detection doesnt work.

I have looked into sources of findCirclesGrid:

• findCirclesGrid itself placed in modules/calib3d/src/calibinit.cpp
• All related functions are in modules/calib3d/src/circlesgrid.cpp

So, I want to understand how findCirclesGrid works and find out some ways to debug and improve it. I dont think I can improve it generally, but I can use such tricks, as tuning parameters for my pattern or add some pre detection of area where pattern is placed and then execute findCirclesGrid only for subarea of total image.

Quesitons:

1. circlesgrid.cpp has #ifdef DEBUG_CIRCLES, if turn it on, it produce 1 warning and 3 errors, but them easily can be fixed. I turned it on, rebuilt opencv, but cant see any difference, maybe it debug some logic, that is not used in my case. What is DEBUG_CIRCLES for?

2. There are CirclesGridFinderParameters parameters. What are they for? I think it is possible to add another option for findCirclesGrid and set different values.

3. There is const Ptr<featuredetector> &blobDetector option for findCirclesGrid. What is it for? What is possible values? As I listened somewhere before, It uses SimpleBlobDetector, but how "good" is it? Are there other blob detectors in opencv?

4. Where I can learn how circle grid finder works, except the sources?

5. Is it possible to see any debug info? For example all circles, that method have found and so on, to better understand, why it cant recognize pattern.

P.S. I use circle grid, but not chessboard, because chessboard detection is very very slow, but I need to have (in best case) as more fps as possible.

And I would be happy to learn any other your ideas about described above. Thanks!