Basic Image AlgorithmS Library
2.8.0
|
functions for spherical undistortion of given images, needs image dimensions, principal point and focal length as input additional to the image data. More...
#include <Image/CylinderMapping.hh>
Public Member Functions | |
CylinderMapping () | |
virtual int | GetBoundingBox (unsigned int, unsigned int, unsigned int sinkwidth, unsigned int sinkheight, int &tlx, int &tly, int &brx, int &bry) |
calculates the bounding box in sink image, where to do the backward mapping. More... | |
int | GetJacobian (const HomgPoint2D &sink, Matrix2x2< double > &Jacobian) const |
get jacobian (including concatenated mappings) More... | |
int | GetSourceCoordinates (const HomgPoint2D &sink, HomgPoint2D &source) const |
wrapper function to allow the lookup implementation to be shared with other algorithms. More... | |
void | Reset () |
if you want to call Map() twice for this object with different params, call Reset() before More... | |
void | SetConcatenation (BIAS::BackwardMapping< unsigned char, unsigned char > *pCon) |
avoid intermediate image and concatenate two backward mappings More... | |
void | setFocalLength (const double fx, const double fy) |
Set the focal length of the camera. More... | |
void | setPrincipalPoint (const double px, const double py) |
Set the principal point of the camera. More... | |
void | SetPyramidSize (const int newsize) |
sets pyramid size to pyramid and updates if neccessary More... | |
virtual void | UpdatePyramidSize (const ROI &ROIsink, int srcwidth, int srcheight) |
uses corners of sink roi (and few other sample points) to estimate maximum local scaling (and thus required pyramid level) More... | |
User interfaces | |
int | Map (const Image< unsigned char > &src, Image< unsigned char > &sink, InterpolationMethod=MapTrilinear, bool newSink=false, double SuperSampling=1.0) |
backward mapping with various interpolations More... | |
int | Map (Image< unsigned char > &sink) |
use this for subsequent calls to avoid pyramid recalculation when using tri-filtering More... | |
int | GetDisplacementMap (Image< float > &dismap, int width, int height) |
precomputes lookup coordinates and computes displacement map int TEXTURE coordinates, according to the size of src (or width,height) More... | |
int | GetDisplacementMap (Image< float > &dismap, Image< unsigned char > &src) |
int | PrepareLookupTableMapping (const Image< unsigned char > &src, Image< unsigned char > &sink, InterpolationMethod method, bool newSink=false) |
precomputes lookup coordinates for accessing src More... | |
int | MapWithLookupTable (const Image< unsigned char > &src, Image< unsigned char > &sink, InterpolationMethod method) |
applies precomputed coordinates in src, fast for repeated usages of same mapping function More... | |
int | GetLookupTable (const std::string &filename, InterpolationMethod method) |
Returns the LUT generated by PrepareLookupTableMapping() as an file. More... | |
int | GetLookupTable (float *lutImageRow, InterpolationMethod method) |
int | GetLookupTableSize (unsigned int &width, unsigned int &channels, InterpolationMethod method) |
returns the size of the current LUT. More... | |
int | SetLookupTable (const std::string &filename, InterpolationMethod &method) |
Loads the LUT from a file, replaces the call to PrepareLookupTableMapping(). More... | |
int | SetLookupTable (const float *lutImageRow, unsigned int width, InterpolationMethod &method) |
Static Public Member Functions | |
static void | GenerateTestImage (Image< unsigned char > &testimage, bool highFrequencyCross=true, unsigned chardark=5, unsigned charbright=127, const Matrix3x3< double > &Hinv=Matrix3x3< double >(MatrixIdentity)) |
generates a siemens star like test image with lots of different frequencies to test backward mapping More... | |
Protected Member Functions | |
virtual void | BuildPyramid_ (const Image< unsigned char > &source, bool forceInit=true, int numlayers=-1) |
compute maximum number of pyramid levels needed More... | |
virtual int | CalcCoordOffset_ (const Image< unsigned char > &sink, const Image< unsigned char > &source) |
result in offsetX_,offsetY_ More... | |
virtual int | ChangeImgSize_ (Image< unsigned char > &, const Image< unsigned char > &) |
void | ClipBoundingBoxToROICorners_ (const BIAS::Image< unsigned char > &sink, int &tlx, int &tly, int &brx, int &bry) const |
clip computed region in dest image to roi More... | |
void | ClipValue_ (const double &value, unsigned char &newvalue) |
clip interpolated value to outputstoragetype and merge old and new value according to alpha More... | |
virtual int | GetSourceCoordinates_ (const BIAS::HomgPoint2D &sink, BIAS::HomgPoint2D &source) const |
this does the trick More... | |
geometrical coordinate mapping functions | |
virtual int | GetJacobian_ (const HomgPoint2D &sink, Matrix2x2< double > &Jacobian) const |
numeric approximation of jacobian, reimplement in derived class to make an analytic jacobian More... | |
void | ComputeLocalPyramidLayer_ (const HomgPoint2D &p_sink, double &localscale) |
computes pyramid layer for trilinear filtering, e.g. More... | |
pixel-value-mapping worker functions | |
int | MapTri_ (Image< unsigned char > &sink) |
map image avoiding aliasing More... | |
int | MapTrilinearGreySimple_ (Image< unsigned char > &sink) |
fast trilinear grey without special features More... | |
int | MapBi_ (const Image< unsigned char > &source, Image< unsigned char > &sink, InterpolationMethod interpolationQuality) |
bilinear, bicubc and nearest neighbor interpolation More... | |
int | GetImageValue_ (const double &xsource, const double &ysource, const Image< unsigned char > &im, unsigned int channel, double &result) |
worker function, which handles bilinear/bicubic interpolation, borders and weights More... | |
int | GetTrilinearImageValue_ (const double &xsource, const double &ysource, const double &scale, unsigned int channel, double &result) |
worker function, which handles bilinear/bicubic interpolation, pyramid levels, borders and weights More... | |
int | GetAnisotropicImageValue_ (const double &xsource, const double &ysource, Matrix2x2< double > &Jacobian, unsigned int channel, double &thereturnvalue) |
use jacobian of mapping function to do anisotropic antialiasing More... | |
Protected Attributes | |
bool | aliasing_ |
set to true if possibility of aliasing is detected during mapping More... | |
BIAS::Image< float > | alphaImg_ |
has same size as overlap region used for blending More... | |
bool | autoPyramidSize_ |
pyramid size set by user or computed automatically ? More... | |
double | camAngleX_ |
double | camAngleY_ |
double | focalX_ |
double | focalY_ |
double | height_ |
source image height More... | |
bool | incomplete_ |
set to true if not every pixel could be computed More... | |
InterpolationMethod | interpolationType_ |
which interpolation method are we using More... | |
int | offsetX_ |
needed for newDist More... | |
int | offsetY_ |
BackwardMapping< unsigned char, unsigned char > * | pConcatenation_ |
BWM_LUT_Entry_Anisotropic * | pLUT_Ani_ |
NOT IMPLEMENTED (YET ?) More... | |
BWM_LUT_Entry_Bicubic * | pLUT_Bic_ |
BWM_LUT_Entry_Bilinear * | pLUT_Bil_ |
int | pLUT_Bil_size |
BWM_LUT_Entry_Nearest * | pLUT_Nea_ |
lookup-tables for precomputed positions in source, same size as dst.PixelCount More... | |
int | pLUT_Nea_size |
BWM_LUT_Entry_Trilinear * | pLUT_Tri_ |
int | pLUT_Tri_size |
double | px_ |
double | py_ |
PyramidImage< unsigned char > | pyramid_ |
this contains a pyramid of the last source image for anti-aliasing More... | |
unsigned | pyramidSize_ |
bool | rangeChecked_ |
The interpolated value is computed in double; if clipped value is not specialized for your output storage type (e.g. More... | |
ROI | ROI_ |
the roi of the last source image More... | |
double | superSampling_ |
if larger than 1, super resolution is active More... | |
double | width_ |
source image width More... | |
functions for spherical undistortion of given images, needs image dimensions, principal point and focal length as input additional to the image data.
Useful for PanoramaMapping ! See also BIAS::BackwardMapping for further details.
Definition at line 46 of file CylinderMapping.hh.
CylinderMapping::CylinderMapping | ( | ) |
Definition at line 25 of file CylinderMapping.cpp.
|
protectedvirtualinherited |
compute maximum number of pyramid levels needed
|
protectedvirtualinherited |
result in offsetX_,offsetY_
|
protectedvirtualinherited |
|
protectedinherited |
clip computed region in dest image to roi
|
inlineprotectedinherited |
clip interpolated value to outputstoragetype and merge old and new value according to alpha
This function must be inplemented for diferent template types rather than for derived classes, e.g. if bicubic interpolation estimates the grey value 257.8 for an unsinged char image, this is rounded and clipped here to 255.0 since this is the maximum allowed uchar.
|
inlineprotectedinherited |
computes pyramid layer for trilinear filtering, e.g.
localscale 0.5 means best resolution and second best are averaged
Definition at line 366 of file BackwardMapping.hh.
|
staticinherited |
generates a siemens star like test image with lots of different frequencies to test backward mapping
testimage | initialized image of user defined size which will be filled |
highFrequencyCross | generates an additional high frequency line |
dark | black image value, e.g. close to 0 |
dark | white image value, e.g. close to 255 |
Hinv | homography to transform pattern (if desired) |
|
protectedinherited |
use jacobian of mapping function to do anisotropic antialiasing
|
inlinevirtualinherited |
calculates the bounding box in sink image, where to do the backward mapping.
The resulting coordinates can be negative ! The br position is the first pixel outside the region(as for a ROI). Implement this in a derived class for speeding up calculation.
Reimplemented in BIAS::ProjectionMapping< unsigned char, unsigned char >.
Definition at line 248 of file BackwardMapping.hh.
|
inherited |
precomputes lookup coordinates and computes displacement map int TEXTURE coordinates, according to the size of src (or width,height)
|
inherited |
|
inlineprotectedinherited |
worker function, which handles bilinear/bicubic interpolation, borders and weights
|
inlineinherited |
get jacobian (including concatenated mappings)
Definition at line 302 of file BackwardMapping.hh.
References BIAS::MatrixIdentity.
|
protectedvirtualinherited |
numeric approximation of jacobian, reimplement in derived class to make an analytic jacobian
|
inherited |
Returns the LUT generated by PrepareLookupTableMapping() as an file.
|
inherited |
|
inherited |
returns the size of the current LUT.
|
inlineinherited |
wrapper function to allow the lookup implementation to be shared with other algorithms.
Definition at line 272 of file BackwardMapping.hh.
|
protectedvirtual |
this does the trick
Reimplemented from BIAS::BackwardMapping< unsigned char, unsigned char >.
Definition at line 55 of file CylinderMapping.cpp.
|
protectedinherited |
worker function, which handles bilinear/bicubic interpolation, pyramid levels, borders and weights
|
inherited |
backward mapping with various interpolations
Sink must be initialized with correct size and background color for invalid pixels. This way you can call it several times to create a panorama from several source images. For each pixel in sink, GetSourceCoordinates is called and the value in source interpolated.
newSink,if | true a new sink image is created that is large enough to hold the old sink and the new mapped src img. |
SuperSampling | if > 1.0, intermediate image with isotropically enlarged width and height (by factor SuperSampling) is created and downsampled for the final image (most useful for nonlinear mappings) |
|
inherited |
use this for subsequent calls to avoid pyramid recalculation when using tri-filtering
|
protectedinherited |
bilinear, bicubc and nearest neighbor interpolation
|
protectedinherited |
map image avoiding aliasing
This is almost correct regarding the sampling theorem, because it uses trilinear or anisotropic filtering over a pyramid. The local sampling frequency is estimated by analyzing the jacobian of the homography as a R^2->R^2 mapping. This is very slow. If possible, bicubic interpolation is done in the image, at borders (high pyramid levels) only bilinear.
In auto mode pyramid size is checked
|
protectedinherited |
fast trilinear grey without special features
assumes one channel grey image, no alpha blending, no concatenation, no 2d offset (from auto image size) and no super sampling
|
inherited |
applies precomputed coordinates in src, fast for repeated usages of same mapping function
|
inherited |
precomputes lookup coordinates for accessing src
If you want to apply the same mapping function over and over again, e.g. radial undistortion for a series of images, call this function once and MapWithLookupTable every time. sink must be of correct size !
void CylinderMapping::Reset | ( | ) |
if you want to call Map() twice for this object with different params, call Reset() before
Definition at line 30 of file CylinderMapping.cpp.
|
inlineinherited |
avoid intermediate image and concatenate two backward mappings
Imagine that the source image is transformed with pcon into the intermediate image, which is then transformed by this into the sink
Definition at line 319 of file BackwardMapping.hh.
void CylinderMapping::setFocalLength | ( | const double | fx, |
const double | fy | ||
) |
Set the focal length of the camera.
Defaults to 140 degrees field of view in y-direction
fx | |
fy |
Definition at line 42 of file CylinderMapping.cpp.
|
inherited |
Loads the LUT from a file, replaces the call to PrepareLookupTableMapping().
|
inherited |
void CylinderMapping::setPrincipalPoint | ( | const double | px, |
const double | py | ||
) |
Set the principal point of the camera.
px | defaults to half image size |
py | defaults to half image size |
Definition at line 48 of file CylinderMapping.cpp.
|
inherited |
sets pyramid size to pyramid and updates if neccessary
|
virtualinherited |
uses corners of sink roi (and few other sample points) to estimate maximum local scaling (and thus required pyramid level)
|
protectedinherited |
set to true if possibility of aliasing is detected during mapping
Definition at line 509 of file BackwardMapping.hh.
|
protectedinherited |
has same size as overlap region used for blending
Definition at line 538 of file BackwardMapping.hh.
|
protectedinherited |
pyramid size set by user or computed automatically ?
Definition at line 491 of file BackwardMapping.hh.
|
protected |
Definition at line 85 of file CylinderMapping.hh.
|
protected |
Definition at line 86 of file CylinderMapping.hh.
|
protected |
Definition at line 83 of file CylinderMapping.hh.
|
protected |
Definition at line 84 of file CylinderMapping.hh.
|
protectedinherited |
source image height
Definition at line 535 of file BackwardMapping.hh.
|
protectedinherited |
set to true if not every pixel could be computed
Definition at line 512 of file BackwardMapping.hh.
|
protectedinherited |
which interpolation method are we using
Definition at line 495 of file BackwardMapping.hh.
|
protectedinherited |
needed for newDist
Definition at line 529 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 529 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 540 of file BackwardMapping.hh.
|
protectedinherited |
NOT IMPLEMENTED (YET ?)
Definition at line 525 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 526 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 517 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 521 of file BackwardMapping.hh.
|
protectedinherited |
lookup-tables for precomputed positions in source, same size as dst.PixelCount
Definition at line 516 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 520 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 518 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 522 of file BackwardMapping.hh.
|
protected |
Definition at line 80 of file CylinderMapping.hh.
|
protected |
Definition at line 81 of file CylinderMapping.hh.
|
protectedinherited |
this contains a pyramid of the last source image for anti-aliasing
Definition at line 486 of file BackwardMapping.hh.
|
protectedinherited |
Definition at line 492 of file BackwardMapping.hh.
|
protectedinherited |
The interpolated value is computed in double; if clipped value is not specialized for your output storage type (e.g.
ushort), this boolean indicates that the generic conversion (e.g. double->ushort) could have introduced artefacts (65536.0 -> 1).
Definition at line 505 of file BackwardMapping.hh.
|
protectedinherited |
the roi of the last source image
Definition at line 488 of file BackwardMapping.hh.
|
protectedinherited |
if larger than 1, super resolution is active
Definition at line 498 of file BackwardMapping.hh.
|
protectedinherited |
source image width
Definition at line 532 of file BackwardMapping.hh.