# Revision history [back]

Ok, I've been wracking my brain on this and I think I've finally solved it!

Tl;dr -- make sure the edges are well represented by the checkerboard in your calibration images.

The key is that the distortion is extreme at the edges, and my theory was that without good checkerboard representation at the edges, the edge distortion solution would not be very accurate. This seems to have fixed it. If you want some numbers for navel-gazing, here are my distCoeffs for two different calibration image sets: one close up, the other mostly far away.

Note: the coefficients are both positive and negative (meaning "moustache distortion" and not monotonic.) Note in particular the really big values for the far away images -- indicating severe edge distortion. My idea was that since distortion is mild in the center, if all my checkerboards are in the center, the distortion could solve in widely varying ways, subject to factors like roundoff error and such.

Looks like my theory is correct -- the coefficients and ROI converge nicely as I increase the images for the near images. Not quite so nice for the far ones.

Bonus ProTip (from Paul Debevec's PhD thesis, chapter 4) -- you can't do gamma correction (or any lightening) on calibration images, because this can shrink or expand the edges of white on black squares!

(k1, k2, p1, p2, k3 -- p is the center point of the distortion.)

Far:

• Dec 13, 10 far images: dist [[-0.36835 5.26118 -0.01009 -0.00408 -31.85337]] roi (31, 94, 1843, 889)
• Dec 13, 50 far images: dist [[ 0.10918 0.78833 -0.00348 0.00295 -5.18248]] roi (0, 0, 0, 0)
• Dec 13, 100 far images: dist [[ 0.11246 0.55816 -0.00238 0.00048 -3.41276]] roi (0, 0, 0, 0)

Close:

• Dec 14, 10 close images: dist [[ 0.09757 -0.11132 -0.0049 -0.00319 0.05245]] roi (8, 14, 1905, 1058)
• Dec 14, 50 close images: dist [[ 0.16167 -0.38233 -0.00299 -0.00002 0.21451]] roi (9, 5, 1901, 1067)
• Dec 14, 100 close images: dist [[ 0.17922 -0.45282 -0.00315 -0.00019 0.29558]] roi (8, 4, 1903, 1069)
• Dec 14, 200 close images: dist [[ 0.18474 -0.46364 -0.00253 -0.00078 0.30383]] roi (7, 5, 1904, 1068)
• Dec 14, 287 close images: dist [[ 0.18519 -0.46466 -0.00253 -0.00083 0.30463]] roi (7, 5, 1904, 1068)