1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Runs the full mrgingham chessboard detector on an image
SYNOPSIS
points = mrgingham.find_board(image)
[ points is an array of shape (N*N,2), the ordered list of ]
[ pixel coordinates in the grid ]
This function runs the full mrgingham sequence:
- pre-process image
- find chessboard corners (or blobs)
- find an NxN grid in the set of corners
- refine
No broadcasting is supported by this function
ARGUMENTS
- image: numpy array of shape (H,W) and dtype np.uint8. This is the image we're
processing. Must be densely-stored, grayscale image
- blobs: optional boolean, defaulting to False. If True, we look for
black-on-white blobs, instead of chessboard corners. If blobs: we MUST have
image_pyramid_level==0
- image_pyramid_level: optional integer defaulting to -1. This can be given to
operate on a downsampled version of the image. 0 means "original image", 1
means "downsample by a factor of 2 in each dimension", 2 means "downsample by
a factor of 4 in each dimension" and so on. image_pyramid_level < 0 (the
default) means "start with a downsampled image, and then refine the results by
repeatedly reducing the downsampling. If blobs: image_pyramid_level==0 is the
only allowed option
- gridn: optional integer defaulting to 10. We detect an NxN grid of corners,
where N is given by this argument
- debug: optional boolean, defaulting to False. If True, this will dump various
intermediate results into /tmp and it will report more stuff on standard out.
Most of the intermediate results are self-plotting data files. Run them. This
does the same thing as "mrgingham --debug"; the Python output is unaffected.
- debug_sequence: optional string "X,Y" where X and Y are integers. In addition
to "debug", this produces diagnostics when searching for sequence candidates.
X,Y are the approximate image coordinates of the start of a given sequence
(corner on the edge of a chessboard. This doesn't need to be exact; mrgingham
will report on the nearest corner. This does the same thing as "mrgingham
--debug-sequence"; the Python output is unaffected.
RETURNED VALUE
A numpy array of shape (N*N,2) containing ordered pixel coordinates of the grid
found in the image. If no grid was found, None is returned.
|