QRfit Class Reference

#include <imgclass.hpp>

Inheritance diagram for QRfit:

Inheritance graph
base refererrect $classimgbase.html 37,109 127,133rect $classimgbase.html 6,19 158,43
[legend]

List of all members.


Detailed Description

Polynomial fit to correct pixel differences.

QRfit is a corrector, that uses a set of reference images to adapt and apply correction curves to every pixel. It fits polynomials of degree order-1 to the inverse of the sensor response function. These polynomials are then applied to the corresponding pixels to get a normalized intensity.

Since fitting lasts long (several seconds on a P4 1.6GHz) and it is inconvenient to specify the reference image set in every program, QRfit allows saving and retrieving the coefficients to disk for significant performance speedup.

Definition at line 773 of file imgclass.hpp.


Public Types

typedef T data_t
 The base data type, for convenience.

Public Member Functions

 QRfit (bild16 *refbilder, float *refw, int nrefimg, int order_=4)
 Construct the QRfit corrector from reference images.
 QRfit (const char *fname)
 Construct the corrector from a file.
 ~QRfit ()
void write (const char *fname) const
 Write the coefficients to a file.
void read (const char *fname) THROWSPEC
 Read the coefficients from a file.
float operator() (int y, int x, float val) const
 Apply correction to a normalized intensity value.
const lutoperator() (int y, int x) const
 Return an array with the coefficients.
float get_coeff (int x, int y, int n) const
 Get one coefficient.
imgbase< s_x, s_y, T > & operator/= (const imgbase< s_x, s_y, T > &what)
 Arithmetic operator.
imgbase< s_x, s_y, T > & operator/= (const T &what)
 Arithmetic operator.
imgbase< s_x, s_y, T > & operator*= (const imgbase< s_x, s_y, T > &what)
 Arithmetic operator.
imgbase< s_x, s_y, T > & operator*= (const T &what)
 Arithmetic operator.
imgbase< s_x, s_y, T > & operator-= (const imgbase< s_x, s_y, T > &what)
 Arithmetic operator.
imgbase< s_x, s_y, T > & operator-= (const T &what)
 Arithmetic operator.
imgbase< s_x, s_y, T > & operator+= (const imgbase< s_x, s_y, T > &what)
 Arithmetic operator.
imgbase< s_x, s_y, T > & operator+= (const T &what)
 Arithmetic operator.

Public Attributes

const int SIZEX
 save the s_x template parameter
const int SIZEY
 save the s_y template parameter

Protected Attributes

data_t ** bild

Private Member Functions

lutoperator() (int y, int x)
 Element extraction operator.
void polyfit (double *bildwerte)
 Fit the polynomial to the values "bildwerte".

Private Attributes

int nref
int order
lut refwerte
double ** R
double * d
double * b
double * koeff

Static Private Attributes

static const char magic [] = "QRfit"

Member Typedef Documentation

template<int s_x, int s_y, typename T>
typedef T imgbase< s_x, s_y, T >::data_t [inherited]

The base data type, for convenience.

You can use this typedef to extract the type of the elements from the derived classes.

Example:

Definition at line 123 of file imgclass.hpp.


Constructor & Destructor Documentation

QRfit::QRfit ( bild16 refbilder,
float *  refw,
int  nrefimg,
int  order_ = 4 
)

Construct the QRfit corrector from reference images.

Definition at line 964 of file imgclass.cpp.

References b, d, bild16::intensity_max, koeff, nref, order, polyfit(), R, reserve_2D(), imgbase< s_x, s_y, T >::SIZEX, and imgbase< s_x, s_y, T >::SIZEY.

QRfit::QRfit ( const char *  fname  ) 

Construct the corrector from a file.

Definition at line 996 of file imgclass.cpp.

References b, d, koeff, R, and read().

QRfit::~QRfit (  ) 

Definition at line 1009 of file imgclass.cpp.

References b, d, delete_2D(), koeff, and R.


Member Function Documentation

void QRfit::write ( const char *  fname  )  const

Write the coefficients to a file.

Definition at line 1016 of file imgclass.cpp.

References magic, nref, order, refwerte, imgbase< s_x, s_y, T >::SIZEX, and imgbase< s_x, s_y, T >::SIZEY.

void QRfit::read ( const char *  fname  ) 

Read the coefficients from a file.

Definition at line 1035 of file imgclass.cpp.

References magic, nref, order, refwerte, imgbase< s_x, s_y, T >::SIZEX, imgbase< s_x, s_y, T >::SIZEY, and STHROW.

Referenced by QRfit().

float QRfit::operator() ( int  y,
int  x,
float  val 
) const

Apply correction to a normalized intensity value.

Definition at line 1071 of file imgclass.cpp.

References order.

const lut& QRfit::operator() ( int  y,
int  x 
) const [inline]

Return an array with the coefficients.

Reimplemented from imgbase< s_x, s_y, T >.

Definition at line 788 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::operator()().

float QRfit::get_coeff ( int  x,
int  y,
int  n 
) const

Get one coefficient.

Definition at line 1084 of file imgclass.cpp.

References order, and STHROW.

lut& QRfit::operator() ( int  y,
int  x 
) [inline, private]

Element extraction operator.

Parenthesis are used to index a pixel of the image. This idea is borrowed from the octave C++ interface. The order of the arguments is y, x. This order should imitate the old C way in order not to confuse people from EP~V

Reimplemented from imgbase< s_x, s_y, T >.

Definition at line 794 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::operator()().

void QRfit::polyfit ( double *  bildwerte  )  [private]

Fit the polynomial to the values "bildwerte".

Definition at line 1090 of file imgclass.cpp.

References b, d, koeff, nref, order, QR(), R, rdsolve(), and refwerte.

Referenced by QRfit().

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator/= ( const imgbase< s_x, s_y, T > &  what  )  [inline, inherited]

Arithmetic operator.

This operator divides every pixel of the image by the corresponding value in what. It leaves the value unchanged if the denominator is zero, thus avoiding division by zero

Definition at line 224 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator/= ( const T &  what  )  [inline, inherited]

Arithmetic operator.

This operator divides every pixel by the constant value what

Definition at line 261 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator*= ( const imgbase< s_x, s_y, T > &  what  )  [inline, inherited]

Arithmetic operator.

This operator multiplies every pixel of the image by the corresponding value in what.

Definition at line 236 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator*= ( const T &  what  )  [inline, inherited]

Arithmetic operator.

This operator multiplies every pixel by the constant value what

Definition at line 272 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator-= ( const imgbase< s_x, s_y, T > &  what  )  [inline, inherited]

Arithmetic operator.

This operator subtracts every pixel of what from the corresponding value in the image.

Definition at line 249 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator-= ( const T &  what  )  [inline, inherited]

Arithmetic operator.

This operator subtracts the constant value what from every pixel in the image

Definition at line 283 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator+= ( const imgbase< s_x, s_y, T > &  what  )  [inline, inherited]

Arithmetic operator.

This operator adds every pixel in what to the corresponding pixel value in the image

Definition at line 295 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.

template<int s_x, int s_y, typename T>
imgbase< s_x, s_y, T > & imgbase< s_x, s_y, T >::operator+= ( const T &  what  )  [inline, inherited]

Arithmetic operator.

This operator adds the constant value what to every pixel in the image

Definition at line 307 of file imgclass.hpp.

References imgbase< s_x, s_y, T >::bild, and MAP.


Member Data Documentation

int QRfit::nref [private]

Definition at line 792 of file imgclass.hpp.

Referenced by polyfit(), QRfit(), read(), and write().

int QRfit::order [private]

Definition at line 792 of file imgclass.hpp.

Referenced by get_coeff(), operator()(), polyfit(), QRfit(), read(), and write().

lut QRfit::refwerte [private]

Definition at line 793 of file imgclass.hpp.

Referenced by polyfit(), read(), and write().

double** QRfit::R [private]

Definition at line 798 of file imgclass.hpp.

Referenced by polyfit(), QRfit(), and ~QRfit().

double* QRfit::d [private]

Definition at line 799 of file imgclass.hpp.

Referenced by polyfit(), QRfit(), and ~QRfit().

double * QRfit::b [private]

Definition at line 799 of file imgclass.hpp.

Referenced by polyfit(), QRfit(), and ~QRfit().

double * QRfit::koeff [private]

Definition at line 799 of file imgclass.hpp.

Referenced by polyfit(), QRfit(), and ~QRfit().

const char QRfit::magic = "QRfit" [static, private]

Definition at line 800 of file imgclass.hpp.

Referenced by read(), and write().

template<int s_x, int s_y, typename T>
const int imgbase< s_x, s_y, T >::SIZEX [inherited]

template<int s_x, int s_y, typename T>
const int imgbase< s_x, s_y, T >::SIZEY [inherited]

template<int s_x, int s_y, typename T>
data_t** imgbase< s_x, s_y, T >::bild [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Fri Jul 24 12:49:18 2009 for Xgrayimg Library by  doxygen 1.5.5