apt-get install hugin
Start hugin
.
Menu "Interface", select "Advanced" (or "Expert").
In the "Advanced" window, menu "Edit", select "Add Image" to load the camera image.
In the popup, select Lens Type: Normal (Rectilinear), HFOV(v): 60 degrees. This does not actually have any effect for this procedure.
Switch to the Control Points tab, which shows the same image twice.
At bottom-right:
Then for each chessboard inner corner:
Click mouse in left image near the correct place, will show "new" label. A small crosshair will be shown on the pixel, and an enlargement will be shown next to it.
While keeping the mousepointer over the left image, use the arrow keys to finetune. This provides 1/3rd subpixel accuracy.
Then in the right image, click somewhere arbitrary -- but it works best to make a rows/columns grid there as well.
This will immediately add a control point number (starting at 0) and draw a line.
Then at the bottom-center, select Mode: "Normal". This will stop drawing the connecting lines, which would become very slow.
Repeat this for all inner corners. Start with the first row left to right, then the second row left to right, then the third row, etc.
For a 9x7 chessboard, there will be 8 inner corners per row, and 6 rows. First row will get labels 0 -- 7, second row 8 -- 15, etc.
Menu "File", select "Save As", in .pto format.
Exit hugin.
Finally convert hugin .pto file to (partial) input for
camcalibplanes
:
./pto2gridpix 8 6 < file.pto > file.json
("8 6" is for a 9x7 chessboard)
To add a few points to an incomplete opencv-findcorners
result:
Just use hugin for the missing/wrong points, then use pto2gridpix
with "fake" small grid size. Edit the resulting list into the
opencv-findcorners
result manually.
For example: when opencv-findcorners
refuses to detect the leftmost
column, just specify a smaller chessboard size for it. This will still
cause it to number the detected pixels from column 0 and upwards. Then
use hugin to make a list for the leftmost column only, and edit this
into the opencv-findcorners output as "-1" column. The row/column
numbers have no absolute meaning, they only specify a relative
distance to neighbors.
Beware: opencv-findcorners
may produce upside-down or sideways
output. In such cases, adjust any hugin addition correspondingly.