vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Classes | Typedefs | Functions | Variables
ca_correct.cc File Reference
#include <iostream>
#include <vspline/vspline.h>
#include <vigra/stdimage.hxx>
#include <vigra/imageinfo.hxx>
#include <vigra/impex.hxx>

Go to the source code of this file.

Classes

struct  ev_radial_correction
 
struct  ev_ca_correct
 

Typedefs

typedef vigra::RGBValue< float, 0, 1, 2 > pixel_type
 
typedef vigra::TinyVector< float, 2 > coordinate_type
 
typedef vspline::bspline< pixel_type, 2 > spline_type
 
typedef vigra::MultiArray< 2, pixel_typetarget_type
 
typedef vspline::evaluator< coordinate_type, float > ev_type
 
typedef vspline::mirror_gate< float > gate_type
 
typedef vspline::map_functor< coordinate_type, VSIZE, gate_type, gate_typemapper_type
 

Functions

int main (int argc, char *argv[])
 

Variables

const int VSIZE = vspline::vector_traits < float > :: size
 ca_correct.cc More...
 

Typedef Documentation

◆ coordinate_type

typedef vigra::TinyVector< float , 2 > coordinate_type

Definition at line 107 of file ca_correct.cc.

◆ ev_type

Definition at line 121 of file ca_correct.cc.

◆ gate_type

typedef vspline::mirror_gate< float > gate_type

Definition at line 127 of file ca_correct.cc.

◆ mapper_type

Definition at line 132 of file ca_correct.cc.

◆ pixel_type

typedef vigra::RGBValue<float,0,1,2> pixel_type

Definition at line 103 of file ca_correct.cc.

◆ spline_type

Definition at line 111 of file ca_correct.cc.

◆ target_type

typedef vigra::MultiArray< 2 , pixel_type > target_type

Definition at line 115 of file ca_correct.cc.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 378 of file ca_correct.cc.

Variable Documentation

◆ VSIZE

const int VSIZE = vspline::vector_traits < float > :: size

ca_correct.cc

Perform correction of chromatic aberration using a cubic polynomial This uses panotools-compatible parameters. Currently only processes 8bit RGB, processing is done on the sRGB data without conversion to linear and back, images with alpha channel won't compute. To see how the panotools lens correction model functions, please refer to https://wiki.panotools.org/Lens_correction_model

compile with: clang++ -std=c++11 -march=native -o ca_correct -O3 -pthread -DUSE_VC ca_correct.cc -lvigraimpex -lVc

you can also use g++ instead of clang++. If you don't have Vc on your system, omit '-DUSE_VC' and '-lVc'. To use highway instead of Vc, use -DUSE_HWY and -lhwy, and to use std::simd, use -DUSE_STSIMD, and compile with c++17 standard. Newer versions of gcc provide a std::simd implementation, if that is missing you need to install it separately.

invoke with ca_correct <image> ar br cr dr ag bg cg dg ab bb cb db d e where 'ar' stands for 'parameter a for red channel' etc., and the trailing d and e are center shift in x and y direction in pixels.

The purpose here is more to demonstrate how to implement the maths using vspline, but the program could easily be fleshed out to become really usable:

  • add alpha channel treatment
  • add processing of 16bit data
  • add colour space management and internal linear processing

Definition at line 99 of file ca_correct.cc.