Simple utility to apply 7+1 parameter distortion (k1, k2, p1, p2, k3, cx, cy, mc) to an image as per the equations here. Made for the sake of learning and to demonstrate the effects of the individual parameters for a university project on camera calibration. Uses nearest neighbour interpolation.
lodepng.h
andlodepng.cpp
from LodePNG (for PNG input/output)nanoflann.hpp
from nanoflann (for fast approximate nearest neighbour interpolation with a KD-tree)
Are present in the source directory, alongside main.cpp
.
warp7p <input.png> <output.png> [k1=0.0] [k2=0.0] [p1=0.0] [p2=0.0] [k3=0.0] [cx=0.5] [cy=0.5] [mc=1.0]
warp7p test.png testout.png -0.4 0 -0.05 0.1 0 0.5 0.5 2.0
Where test.png is:
Produces the resulting out.png:
The effects of individual parameters:
k1 (positive)
k1 (negative)
k2
k3
p1
p2
GPLv2