Warp7p filter. Used:
- STB: stb.
Simple utility to apply 7+1 parameter distortion (k1, k2, k3, p1, p2, cx, cy, mc) to an image as per the equations here. Uses an iterative process to recalculate coordinates, or a pseudo-transformation without an iterative process. Uses bilinear interpolation.
Here this filter is implemented in a full-color version.
./stbiwarp7p [-h] [-k k1 k2 k3] [-p p1 p2] [-c cx cy] [-m mc] [-i] [-x max_iter] input-file output.png
-k k1 k2 k3
The radial distortion coefficient (current = 0.000 0.000 0.000 ).
-p p1 p2
The trapezoidal distortion parameters (current = 0.000 0.000 ).
-c cx cy
The center (current = 0.50 0.50 ).
-m mc
The scale (current = 1.00 ).
-i
Сoordinate transformation direction (current = -1 ).
-x max_iter
The maximum iteration (current = 100 ).
-h
display this help and exit.
Params value:
- default: -k 0.0 0.0 0.0 -p 0.0 0.0 -c 0.5 0.5 -m 1.0
- for example: -k -0.4 0.0 0.0 -p -0.05 0.1 -c 0.5 0.5 -m 2.0
stb_image and stb_image_write by Sean Barrett and others is used to read and write images.
- Clone the repo or download the source
git clone --recurse-submodules https://github.com/ImageProcessing-ElectronicPublications/stbiwarp7p
- Execute
make
- Done. Either use the
stbiwarp7p
executable directly or copy it somewhere in your PATH.
- STB: stb.