92#include <vigra/stdimage.hxx> 
   93#include <vigra/imageinfo.hxx> 
   94#include <vigra/impex.hxx> 
  189    return ( 
d - 1.0 ) / 2.0 ;
 
  199    return sqrt ( 
dy * 
dy ) ;
 
  206                         const double & _height ,
 
  207                         const double & _x_shift ,
 
  208                         const double & _y_shift ,
 
  225    std::cout << 
"dx:     " << 
dx << std::endl ;
 
  226    std::cout << 
"dy:     " << 
dy << std::endl ;
 
  227    std::cout << 
"scale:  " << 
scale << std::endl ;
 
  228    std::cout << 
"rscale: " << 
rscale << std::endl ;
 
  229    std::cout << 
"a:      " << 
a << std::endl ;
 
  230    std::cout << 
"b:      " << 
b << std::endl ;
 
  231    std::cout << 
"c:      " << 
c << std::endl ;
 
  232    std::cout << 
"d:      " << 
d << std::endl ;
 
  246  template < 
class CRD >
 
  264    auto r = sqrt ( cc[0] * cc[0] + cc[1] * cc[1] ) ;
 
  268    auto rr = 
a * r * r * r + 
b * r * r + 
c * r + 
d ;
 
  342  template < 
class IN , 
class OUT >
 
  378int main ( 
int argc , 
char * argv[] )
 
  382    std::cerr << 
"pass a colour image file as first argument" << std::endl ;
 
  383    std::cerr << 
"followed by a, b, c for red, green, blue" << std::endl ;
 
  384    std::cerr << 
"and the horizontal and vertical shift" << std::endl ;
 
  385    std::cerr << 
"like ca_correct xx.jpg 0.0001411 -0.0005236 0.0008456 1.0002093 0 0 0 1 0.0002334 -0.0007607 0.0011446 0.9996757 176 116" 
  390  double ar = atof ( argv[2] ) ;
 
  391  double br = atof ( argv[3] ) ;
 
  392  double cr = atof ( argv[4] ) ;
 
  393  double dr = atof ( argv[5] ) ;
 
  394  double ag = atof ( argv[6] ) ;
 
  395  double bg = atof ( argv[7] ) ;
 
  396  double cg = atof ( argv[8] ) ;
 
  397  double dg = atof ( argv[9] ) ;
 
  398  double ab = atof ( argv[10] ) ;
 
  399  double bb = atof ( argv[11] ) ;
 
  400  double cb = atof ( argv[12] ) ;
 
  401  double db = atof ( argv[13] ) ;
 
  402  double x_shift = atof ( argv[14] ) ; 
 
  403  double y_shift = atof ( argv[15] ) ; 
 
  407  vigra::ImageImportInfo imageInfo ( argv[1] ) ;
 
  429  std::cout << 
"reading image " << argv[1] << 
" from disk" << std::endl ;
 
  431  vigra::importImage ( imageInfo , bspl.
core ) ;
 
  435  std::cout << 
"setting up b-spline interpolator for image data" << std::endl ;
 
  445  float width = imageInfo.width() ;
 
  446  float height = imageInfo.height() ;
 
  450  std::cout << 
"setting up radial correction for red channel:" << std::endl ;
 
  453    ( width , height , x_shift , y_shift , ar , br , cr , dr ) ;
 
  455  std::cout << 
"setting up radial correction for green channel:" << std::endl ;
 
  458    ( width , height , x_shift , y_shift , ag , bg , cg , dg ) ;
 
  460  std::cout << 
"setting up radial correction for blue channel:" << std::endl ;
 
  463    ( width , height , x_shift , y_shift , ab , bb , cb , db ) ;
 
  473  ev_type red_ev ( red_channel ) ;
 
  474  ev_type green_ev ( green_channel ) ;
 
  475  ev_type blue_ev ( blue_channel ) ;
 
  498                          red_ev , green_ev , blue_ev ,
 
  507  std::cout << 
"rendering the target image" << std::endl ;
 
  513  std::cout << 
"storing the target image as 'ca_correct.tif'" << std::endl ;
 
  515  vigra::ImageExportInfo eximageInfo ( 
"ca_correct.tif" );
 
  517  vigra::exportImage ( target ,
 
  519                       .setPixelType(
"UINT8")
 
  520                       .setForcedRangeMapping ( 0 , 255 , 0 , 255 ) ) ;
 
  522  std::cout << 
"done" << std::endl ;
 
int main(int argc, char *argv[])
const int VSIZE
ca_correct.cc
vigra::RGBValue< float, 0, 1, 2 > pixel_type
vspline::map_functor< coordinate_type, VSIZE, gate_type, gate_type > mapper_type
vspline::mirror_gate< float > gate_type
vigra::TinyVector< float, 2 > coordinate_type
vspline::evaluator< coordinate_type, float > ev_type
vspline::bspline< pixel_type, 2 > spline_type
vigra::MultiArray< 2, pixel_type > target_type
class evaluator encodes evaluation of a spline-like object. This is a generalization of b-spline eval...
void eval(const typename base_type::in_type &_coordinate, typename base_type::out_type &_result) const
unvectorized evaluation function. this is delegated to 'feed' above, which reinterprets the arguments...
void transform(const unary_functor_type &functor, const vigra::MultiArrayView< dimension, typename unary_functor_type::in_type > &input, vigra::MultiArrayView< dimension, typename unary_functor_type::out_type > &output, int njobs=vspline::default_njobs, vspline::atomic< bool > *p_cancel=0)
implementation of two-array transform using wielding::coupled_wield.
ev_ca_correct(const ev_radial_correction &_rc_red, const ev_radial_correction &_rc_green, const ev_radial_correction &_rc_blue, const ev_type &_ev_red, const ev_type &_ev_green, const ev_type &_ev_blue, const mapper_type &_m)
ev_radial_correction rc_green
ev_radial_correction rc_red
ev_radial_correction rc_blue
void eval(const IN &c, OUT &result) const
static double d_from_extent(double d)
static double rscale_from_wh(double w, double h)
ev_radial_correction(const double &_width, const double &_height, const double &_x_shift, const double &_y_shift, const double &_a, const double &_b, const double &_c, const double &_d)
void eval(const CRD &in, CRD &result) const
class bspline now builds on class bspline_base, adding coefficient storage, while bspline_base provid...
void prefilter(vspline::xlf_type boost=vspline::xlf_type(1), int njobs=vspline::default_njobs)
prefilter converts the knot point data in the 'core' area into b-spline coefficients....
channel_view_type get_channel_view(const int &channel)
get a bspline object for a single channel of the data. This is lightweight and requires the viewed da...
finally we define class mapper which is initialized with a set of gate objects (of arbitrary type) wh...
void eval(const in_type &in, out_type &out) const
mirror gate 'folds' coordinates into the range. From the infinite number of mirror images resulting f...
class unary_functor provides a functor object which offers a system of types for concrete unary funct...
with the definition of 'simd_traits', we can proceed to implement 'vector_traits': struct vector_trai...
includes all headers from vspline (most of them indirectly)