Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The problem is almost certainly that your object points are incorrect. What you've done is symmetric grid (like a chessboard) which assumes the same number of grid points per row. The asymmetric pattern doesn't. You can try (converted straight from the C++):

objectPoints= []
grid_size = 0.03 # 3cm, or whatever
rows, cols = 4, 11

for i in range(rows):
    for j in range(cols):
        objectPoints.append( ((2*j + i%2)*grid_size, i*grid_size, 0) )

objectPoints= np.array(corners).astype('float32')

I'm posting this as a late answer, for folks coming from Google.

The problem is almost certainly that your object points are incorrect. What you've done is symmetric grid (like a chessboard) which assumes the same number of grid points per row. The asymmetric pattern doesn't. You can try (converted straight from the C++):

objectPoints= []
grid_size = 0.03 # 3cm, or whatever
rows, cols = 4, 11

for i in range(rows):
range(cols):
    for j in range(cols):
range(rows):
        objectPoints.append( i*grid_size, ((2*j + i%2)*grid_size, i*grid_size, , 0) )

objectPoints= np.array(corners).astype('float32')
np.array(objectPoints).astype('float32')

I'm posting this as a late answer, for folks coming from Google.

The problem is almost certainly that your object points are incorrect. What you've done is symmetric grid (like a chessboard) which assumes the same number of grid points per row. The asymmetric pattern doesn't. You can try (converted straight from the C++):

objectPoints= []
grid_size = 0.03 # 3cm, or whatever
rows, cols = 4, 11

for i in range(cols):
    for j in range(rows):
        objectPoints.append( i*grid_size, ((2*j (i*grid_size, (2*j + i%2)*grid_size, , 0) )

objectPoints= np.array(objectPoints).astype('float32')

I'm posting this as a late answer, for folks coming from Google.

asymmetric pattern

I'm posting this as a late answer, for folks coming from Google.

The problem is almost certainly that your object points are incorrect. What you've done is symmetric grid (like a chessboard) which assumes the same number of grid points per row. The asymmetric pattern doesn't. You can try (converted straight This code is adapted from the C++):C++ source. It's worth plotting your object points to double check that it actually looks like your pattern:

objectPoints= []
grid_size = 0.03 # 3cm, or whatever
rows, cols = 4, 11

for i in range(cols):
    for j in range(rows):
        objectPoints.append( (i*grid_size, (2*j + i%2)*grid_size, 0) )

objectPoints= np.array(objectPoints).astype('float32')

scatter(objectPoints[:,0], objectPoints[:,1])

I'm posting this Note that the rows are staggered in the pattern, that's where the asymmetry comes from. The grid_size is the x-spacing between the circles. The loop plots a 4x11 grid, but shifts alternate columns down by grid_size. Here's a plot of the pattern as a late answer, for folks coming from Google.generated:

asymmetric pattern