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