Ask Your Question

jlsb's profile - activity

2020-03-19 14:08:48 -0600 received badge  Famous Question (source)
2017-08-18 08:39:00 -0600 received badge  Notable Question (source)
2016-02-24 08:42:47 -0600 received badge  Popular Question (source)
2012-10-15 10:45:38 -0600 answered a question findCirclesGrid

I'm having the same problem where I use the sample images. I still cannot get this to work within Python. I've tried switching the grid size and I've used symmetric and asymmetric patterns. Nothing is working on my end.

In [20]: img = scipy.misc.imread('~/Documents/data/acircles_pattern.png')
In [20]: cv2.findCirclesGrid(img, (11,4), flags=cv2.CALIB_CB_ASYMMETRIC_GRID)
Out[20]: (False, None)

In [20]: img = scipy.misc.imread('~/Documents/data/acircles_pattern.png')
In [20]: cv2.findCirclesGrid(img, (4,11), flags=cv2.CALIB_CB_ASYMMETRIC_GRID)
Out[20]: (False, None)

image description

2012-10-15 10:44:35 -0600 received badge  Supporter (source)
2012-10-14 03:59:40 -0600 received badge  Editor (source)
2012-10-14 03:54:10 -0600 asked a question findCirclesGrid in Python

I am having some difficulty finding out how to get findCirclesGrid() in the cv2 module working in Python. Here's what I'm using for parameters:

image: an image in the form of a numpy ndarray. patternSize: tuple containing my width and height of the pattern; my case is (4,11) flags: cv2.CALIB_CB_ASYMMETRIC_GRID since my grid is asymmetric

The function executes without an error. The first return value is always False, which seems to indicate that the pattern could not be detected. The second return value, centers, is an numpy ndarray. It looks like this typically:

[[[ 150.26068115 149.73667908]] [[179.99241638 150.15336609]] [[ 210.01210022 149.9016571 ]] [[ 240.06182861 149.86331177]] [[ 149.89584351 180.01303101]] [[ 179.57373047 180.05331421]] [[ 210.33233643 180.1463623 ]] [[ 239.53469849 180.49691772]] [[ 150.08843994 210.23040771]] [[ 180.15136719 209.93945312]] [[ 209.52470398 209.71012878]] [[ 240.57177734 209.7552948 ]]]

Although the first return value is False, I still try to display to the centers using drawChessboardCorners(image,patternSize,True). Then I display the results using cv.ShowImage(), where I first convert the image from an ndarray to an image using cv.fromarray(). The centers are certainly in the wrong locations.

I have tried using a sample image. Even the results from this are not working. The code I am using looks like this:

img = scipy.misc.imread('/mypath/myimage.png')    
cv2.findCirclesGrid(img, (3,11), flags=cv2.CALIB_CB_ASYMMETRIC_GRID)

I am not sure if the problem is due to my images or due to my code. Any advice would be greatly appreciated. Thanks!

JL

Sample image: image description