#include <imgclass.hpp>
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 lut & | operator() (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 | |
lut & | operator() (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" |
The base data type, for convenience.
You can use this typedef
to extract the type of the elements from the derived classes.
Example:
bild16::data_t temp;
Definition at line 123 of file imgclass.hpp.
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 | ) |
QRfit::~QRfit | ( | ) |
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 |
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] |
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.
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.
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.
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.
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.
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.
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.
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.
int QRfit::nref [private] |
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] |
double** QRfit::R [private] |
double* QRfit::d [private] |
double * QRfit::b [private] |
double * QRfit::koeff [private] |
const char QRfit::magic = "QRfit" [static, private] |
save the s_x template parameter
Definition at line 126 of file imgclass.hpp.
Referenced by interpol::interpol(), valleyborder::operator()(), maxborder::operator()(), minborder::operator()(), QRfit(), read(), interpol::read(), write(), and interpol::write().
save the s_y template parameter
Definition at line 129 of file imgclass.hpp.
Referenced by interpol::interpol(), valleyborder::operator()(), maxborder::operator()(), minborder::operator()(), QRfit(), read(), interpol::read(), write(), and interpol::write().
The real data storage. Should not be used by derived classes
Definition at line 161 of file imgclass.hpp.
Referenced by imgbase< s_x, s_y, T >::imgbase(), imgbase< 512, 512, unsigned short >::operator()(), imgbase< s_x, s_y, T >::operator*=(), imgbase< s_x, s_y, T >::operator+=(), imgbase< s_x, s_y, T >::operator-=(), imgbase< s_x, s_y, T >::operator/=(), imgbase< s_x, s_y, T >::operator=(), and imgbase< s_x, s_y, T >::~imgbase().