findCircleGrid detection, how to debug?

asked 2015-02-22 02:33:56 -0600

nikitos1550 gravatar image

updated 2015-02-22 02:42:36 -0600

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 doesn`t 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 don`t 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 can`t 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 can`t 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!

edit retag flag offensive close merge delete

Comments

Point 3 should be your starting point. The main parameters are the minimal and maximal pixelarea of the circles as well as some threholding parameters. Could you post some images? Could you manually measure the size of the circles for your different setups?

FooBar gravatar imageFooBar ( 2015-02-22 08:28:45 -0600 )edit

Thanks, I will prepare image tomorrow.

nikitos1550 gravatar imagenikitos1550 ( 2015-02-26 10:00:47 -0600 )edit

Problem solved!

nikitos1550 gravatar imagenikitos1550 ( 2015-03-17 12:55:44 -0600 )edit

Hi nikitos1550, Can you elaborate on how you ended up solving this issue? I am facing a similar problem albeit with an asymmetrical pattern. I am unable to place a finger on when and why findCirclesGrid is failing.

HolyMoly gravatar imageHolyMoly ( 2017-06-21 10:48:28 -0600 )edit