Calibrating a camera without a defined patternSize


I am trying to use opencv to calibrate a camera

The problem is findChessboardCorners(InputArray image, Size patternSize, OutputArray corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE )
requires a fixed patternSize

and out checkerboard pattern is too large to fit on the screen, so it has no boundaries

This function always returns false even if I count the number of corners horizontally and vertically that are on camera. (there are corners beyond camera FOV which I am not counting, but the patter extends in every direction. And i have 5 x 4 corners visible on camera. But this function returns false

is there a function I can use to calibrate if I dont know the patternSize?

Or can I do 1 corner less in each direction than visibe, so it always has a minimum number of corners in that pattern? Tried htis it still returns false


well, not this one.

  • you MUST know the pattern size
  • ALL squares must be visible in every image
  • there must be a ~1 square white ‘quite zone’ around it
  • one odd, one even size (e.g. 6x7), again, FIXED. (and you need a single, corresponding set of FIXED 3d model points, same for each image)

use a smaller board / smaller squares

using an “infinite” grid is a very good idea to get points in the corners of the view, which is the most important area to have points in. “finite” boards, fully in view, make that almost impossible.

charuco boards are a hack where the “corners” have identity. for a square grid, the corners need no identity.

I’ve been meaning to write code to take any set of corner points and associate them into a square grid that need not have rectangular bounds, i.e. exactly your situation. I haven’t gotten around to it.