Basic Image AlgorithmS Library
2.8.0
|
Inverse Compositional Image Alignment ("Registration") More...
#include <Matcher2D/ImageAlignment.hh>
Public Member Functions | |
void | AddDebugLevel (const long int lv) |
void | AddDebugLevel (const std::string &name) |
int | Align (const PyramidImage< float > &I1, const PyramidImage< float > &I2, Vector< double > ¶ms, Matrix< double > &Cov, int PyramidLevel=-1) |
aligns image1 with image2 with respect to parameters params More... | |
int | AutoAlign (const PyramidImage< float > &I1, const PyramidImage< float > &I2, Vector< double > ¶ms, Matrix< double > &Cov) |
aligns image1 with image2 with respect to parameters params, scale space tracking is used recursively until maximum resolution reached. More... | |
bool | DebugLevelIsSet (const long int lv) const |
bool | DebugLevelIsSet (const std::string &name) const |
int | GetDebugLevel () const |
std::ostream & | GetDebugStream () const |
void | GetDebugStream (std::ostream &os) const |
void | GetLastBrightnessChange (double &scale, double &shift) |
return relative affine transform between i1 and i2 if AffineBrightnessInvariance was active More... | |
int | GetMaxIterations () |
float | GetMaxUpdate () |
ImageAlignment () | |
long int | Name2DebugLevel (const std::string &name) const |
looks up a debuglevel in the internal map, returns 0 if not found More... | |
long int | NewDebugLevel (const std::string &name) |
creates a new debuglevel More... | |
void | PrintDebugLevel (std::ostream &os=std::cout) const |
void | RemoveDebugLevel (const long int lv) |
void | RemoveDebugLevel (const std::string &name) |
void | SetAffineBrightnessInvariance (bool bi) |
enable brightness variance and offset invariant computation More... | |
void | SetAlignmentPixelsRectangular (const LocalAffineFrame &LAF, int numberOfPixels=-1) |
choose any rectangular tracking region and resolution More... | |
void | SetDampening (const double &dampening) |
adds a dampening d to hessian's diag More... | |
void | SetDebugLevel (const long int lv) |
void | SetDebugLevel (const std::string &name) |
void | SetDebugStream (const std::ostream &os) |
void | SetIntensitySigma (const double &sigma) |
set expected standard deviation for grey value noise More... | |
void | SetLineSearch (const double &lineSearch) |
enable/disable and set step width for line search: <=0 disables, 0.1 or 0.5 may be good values. More... | |
void | SetMaxIterations (const int maxiter) |
number of iterations, before the system stops unsuccessfully More... | |
void | SetTextureTransform (const TextureTransform &T) |
pass object type which holds texture transform More... | |
void | SetUpdateThreshold (const double maxerr) |
if a step smaller (norm L2) than this is taken, convergence is declared and the system finishes More... | |
void | ShowDebugLevel (std::ostream &os=std::cout) const |
prints all internally known debuglevels More... | |
int | StrictPyramidAlign (const PyramidImage< float > &I1, const PyramidImage< float > &I2, Vector< double > ¶ms, Matrix< double > &Cov) |
aligns image1 with image2 with respect to parameters params, traditional pyramid based alignment is used, mainly for comparison reasons. More... | |
~ImageAlignment () | |
Static Public Member Functions | |
static long int | GetGlobalDebugLevel () |
static void | SetGlobalDebugLevel (long int lev) |
Protected Member Functions | |
int | CheckConvergence_ (const Vector< double > ¶ms, const Matrix< double > &Cov, const double &pixelAccuracy=0.3) |
check for given cov and params, whether control points move more than pixelAccuracy More... | |
long | ConsumeNextFreeDebuglevel_ () |
returns the next available debuglevel More... | |
Protected Attributes | |
long int | _liDebugLevel |
long int | _liNextDebugLevel |
new concept, debuglevel are managed here in the debug class More... | |
std::map< std::string, long int > | _String2Debuglevel |
std::vector< bool > | active_ |
bool | AffineBrightnessInvariance_ |
compute brightness "invariant" More... | |
std::vector< HomgPoint2D > | ControlPositions_ |
double | Dampening_ |
adds a dampening to hessian's diag: >=0: d, <0 d*largest eigvalue More... | |
double | dev1_ |
double | dev2_ |
std::vector< HomgPoint2D > | ImagePositions_ |
double | intensitySigma_ |
how much noise is expected on intensity values More... | |
int | iterationDebug_ |
internal counter for numbering debug images More... | |
double | LineSearch_ |
if error is not reduced in one step, linesearch times this step is tried set to <=0 to disable line search More... | |
int | MaxIterations_ |
iteration stops after More... | |
float | MaxUpdate_ |
iteration stops if parameter update is less than More... | |
double | mean1_ |
mean and std deviation of image patch More... | |
double | mean2_ |
std::vector< Vector< double > > | SteepestDescentImages_ |
TextureTransform * | T_ |
the warp model More... | |
std::vector< Vector2< double > > | TemplateGradients_ |
std::vector< double > | TemplateGreyValues_ |
gradients and grey values from image 1 More... | |
std::vector< HomgPoint2D > | TemplatePositions_ |
std::vector< double > | TemplateScales_ |
Static Protected Attributes | |
static std::ostream | _zDebugStream |
static long int | GlobalDebugLevel = 0 |
Inverse Compositional Image Alignment ("Registration")
This class implements generic inverse compositional image alignment as proposed by Baker and Matthews in "Lucas-Kanade 20 years on". The model for which you estimate the parameters must be of type TextureTransform (e.g. affine, homography, displacement, camera pose, calibration, ...).
The key idea is that the required inversion of the hessian and the incorporation of the gradients are not recomputed per iteration in this formulation as opposed to the standard KLT.
Definition at line 61 of file ImageAlignment.hh.
BIAS::ImageAlignment::ImageAlignment | ( | ) |
Definition at line 42 of file ImageAlignment.cpp.
|
inline |
Definition at line 65 of file ImageAlignment.hh.
|
inlineinherited |
Definition at line 355 of file Debug.hh.
Referenced by BIAS::GLProjectionParametersBase::AddDebugLevel(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::FilterBase< InputStorageType, OutputStorageType >::FilterBase(), BIAS::ShowCamWxVideoSourceFactory::OpenDevice(), and BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph().
|
inlineinherited |
int BIAS::ImageAlignment::Align | ( | const PyramidImage< float > & | I1, |
const PyramidImage< float > & | I2, | ||
Vector< double > & | params, | ||
Matrix< double > & | Cov, | ||
int | PyramidLevel = -1 |
||
) |
aligns image1 with image2 with respect to parameters params
if no pyramidlevel is supplied the best pyramid level for each pixel is chosen automatically using Cov (scale space tracking)
Definition at line 53 of file ImageAlignment.cpp.
References BIAS::TextureTransform::Clone(), BIAS::TextureTransform::ComposeWithInverseDeltaP(), BIAS::SVD::Compute(), BIAS::PyramidImage< T >::GetAnisotropicImageValue(), BIAS::Image< StorageType >::GetImageData(), BIAS::PyramidImage< T >::GetImageValue(), BIAS::TextureTransform::GetInverseParameters(), BIAS::TextureTransform::GetParameters(), BIAS::SVD::GetS(), BIAS::PyramidImage< T >::GetTrilinearImageValue(), BIAS::SVD::Invert(), BIAS::PyramidImage< T >::IsInROI(), BIAS::TextureTransform::MapBackward(), BIAS::MatrixZero, BIAS::Matrix< T >::MultLeft(), BIAS::Vector< T >::NormL2(), BIAS::Matrix< T >::NormL2(), TNT::Matrix< T >::num_cols(), TNT::Matrix< T >::num_rows(), BIAS::TextureTransform::ParameterInversionJacobian(), BIAS::TextureTransform::ParameterJacobianBackward(), BIAS::ImageIO::Save(), BIAS::Matrix< T >::SetIdentity(), BIAS::TextureTransform::SetParameters(), BIAS::ImageBase::SetZero(), BIAS::PyramidImageInterface< StorageType >::size(), BIAS::Vector< T >::Size(), TNT::Vector< T >::size(), BIAS::FileHandling::toString(), BIAS::Matrix< T >::Trace(), and BIAS::Matrix< T >::Transpose().
int BIAS::ImageAlignment::AutoAlign | ( | const PyramidImage< float > & | I1, |
const PyramidImage< float > & | I2, | ||
Vector< double > & | params, | ||
Matrix< double > & | Cov | ||
) |
aligns image1 with image2 with respect to parameters params, scale space tracking is used recursively until maximum resolution reached.
Requires correct Cov as input.
Definition at line 923 of file ImageAlignment.cpp.
References TNT::Matrix< T >::num_cols(), TNT::Matrix< T >::num_rows(), TNT::Vector< T >::size(), and BIAS::Matrix< T >::Trace().
|
protected |
check for given cov and params, whether control points move more than pixelAccuracy
Definition at line 1123 of file ImageAlignment.cpp.
References BIAS::Matrix< T >::Transpose().
|
inlineprotectedinherited |
|
inlineinherited |
Definition at line 341 of file Debug.hh.
Referenced by BIAS::GenSynthMatches::_AddUniformDistributedOutliers(), BIAS::GenSynthMatches::_CreateCamMovement(), BIAS::GenSynthMatches::_CreateStatic2DPoints(), BIAS::UnscentedTransform::ComputeSigmaPoints_(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::GenSynthMatches::GetGTNormalizedF(), BIAS::MonteCarloTransform::GetSamples_(), and BIAS::MonteCarloTransform::Transform().
|
inlineinherited |
|
inlineinherited |
Definition at line 332 of file Debug.hh.
Referenced by BIAS::listenthread(), BIAS::Image< StorageType >::operator=(), and BIAS::ImageBase::operator=().
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inline |
return relative affine transform between i1 and i2 if AffineBrightnessInvariance was active
i2 = scale * i1 + shift
Definition at line 127 of file ImageAlignment.hh.
|
inline |
Definition at line 109 of file ImageAlignment.hh.
|
inline |
Definition at line 111 of file ImageAlignment.hh.
|
inlineinherited |
|
inlineinherited |
creates a new debuglevel
Definition at line 474 of file Debug.hh.
Referenced by BIAS::COSAC< SolutionType >::COSAC(), BIAS::ProjectionParametersPerspectiveDepth::Init(), BIAS::MonteCarloTransform::MonteCarloTransform(), BIAS::PMatrixEstimation::PMatrixEstimation(), BIAS::PreemptiveRANSAC< SolutionType >::PreemptiveRANSAC(), BIAS::RANSACPreKnowledge< SolutionType >::RANSACPreKnowledge(), BIAS::ROI::ROI(), BIAS::RotationAveraging::RotationAveraging(), BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph(), BIAS::ThreeDOutOpenSceneGraph::ThreeDOutOpenSceneGraph(), BIAS::Triangulation::Triangulation(), and BIAS::UnscentedTransform::UnscentedTransform().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
enable brightness variance and offset invariant computation
Definition at line 105 of file ImageAlignment.hh.
void BIAS::ImageAlignment::SetAlignmentPixelsRectangular | ( | const LocalAffineFrame & | LAF, |
int | numberOfPixels = -1 |
||
) |
choose any rectangular tracking region and resolution
The localaffineframe determines the shape, scale and orientation of the rectangular region used for tracking. The numberofpixelsis a windowsize, e.g. if you pass 9, a 9x9 grid will be used for tracking If you pass -1, each pixel is used for tracking
Definition at line 874 of file ImageAlignment.cpp.
References BIAS::Matrix2x2< T >::det(), BIAS::LocalAffineFrame::GetA(), BIAS::HomgPoint2D, and BIAS::LocalAffineFrame::LocalToGlobal().
|
inline |
adds a dampening d to hessian's diag
dampening,: | >=0: d, <0 -d*largest eigvalue |
Definition at line 140 of file ImageAlignment.hh.
|
inlineinherited |
Definition at line 318 of file Debug.hh.
Referenced by BIAS::ShowCamWxVideoSourceFactory::CreateBumbleBee(), BIAS::ShowCamWxVideoSourceFactory::CreateDCAM(), BIAS::VideoSource_MDcam::ScanBus(), BIAS::GLProjectionParametersBase::SetDebugLevel(), BIAS::VideoSource_Disk::VideoSource_Disk(), BIAS::VideoSource_DV2::VideoSource_DV2(), BIAS::VideoSource_DV::VideoSource_DV_Internal_Init_(), and BIAS::VideoSource_V4L::VideoSource_V4L().
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inline |
set expected standard deviation for grey value noise
This is important if maximum a posteriori-estimation is desired and you provide a correctly scaled prior cov for the warp parameters. Pixels which have smaller gradient than this are rejected.
Definition at line 149 of file ImageAlignment.hh.
|
inline |
enable/disable and set step width for line search: <=0 disables, 0.1 or 0.5 may be good values.
1.0 would mean original step
Definition at line 134 of file ImageAlignment.hh.
|
inline |
number of iterations, before the system stops unsuccessfully
Definition at line 96 of file ImageAlignment.hh.
|
inline |
pass object type which holds texture transform
Definition at line 90 of file ImageAlignment.hh.
References BIAS::TextureTransform::Clone().
|
inline |
if a step smaller (norm L2) than this is taken, convergence is declared and the system finishes
Definition at line 101 of file ImageAlignment.hh.
|
inlineinherited |
int BIAS::ImageAlignment::StrictPyramidAlign | ( | const PyramidImage< float > & | I1, |
const PyramidImage< float > & | I2, | ||
Vector< double > & | params, | ||
Matrix< double > & | Cov | ||
) |
aligns image1 with image2 with respect to parameters params, traditional pyramid based alignment is used, mainly for comparison reasons.
Can be used also if Cov is totally unknown.
Definition at line 1043 of file ImageAlignment.cpp.
References TNT::Matrix< T >::num_cols(), TNT::Matrix< T >::num_rows(), BIAS::PyramidImageInterface< StorageType >::size(), TNT::Vector< T >::size(), and BIAS::Matrix< T >::Trace().
|
protectedinherited |
Definition at line 510 of file Debug.hh.
Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().
|
protectedinherited |
new concept, debuglevel are managed here in the debug class
Definition at line 516 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protectedinherited |
Definition at line 517 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
staticprotectedinherited |
Definition at line 511 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protected |
Definition at line 200 of file ImageAlignment.hh.
|
protected |
compute brightness "invariant"
Definition at line 175 of file ImageAlignment.hh.
|
protected |
Definition at line 196 of file ImageAlignment.hh.
|
protected |
adds a dampening to hessian's diag: >=0: d, <0 d*largest eigvalue
Definition at line 172 of file ImageAlignment.hh.
|
protected |
Definition at line 189 of file ImageAlignment.hh.
|
protected |
Definition at line 189 of file ImageAlignment.hh.
|
staticprotectedinherited |
|
protected |
Definition at line 198 of file ImageAlignment.hh.
|
protected |
how much noise is expected on intensity values
Definition at line 182 of file ImageAlignment.hh.
|
protected |
internal counter for numbering debug images
Definition at line 203 of file ImageAlignment.hh.
|
protected |
if error is not reduced in one step, linesearch times this step is tried set to <=0 to disable line search
Definition at line 179 of file ImageAlignment.hh.
|
protected |
iteration stops after
Definition at line 166 of file ImageAlignment.hh.
|
protected |
iteration stops if parameter update is less than
Definition at line 169 of file ImageAlignment.hh.
|
protected |
mean and std deviation of image patch
Definition at line 189 of file ImageAlignment.hh.
|
protected |
Definition at line 189 of file ImageAlignment.hh.
|
protected |
Definition at line 199 of file ImageAlignment.hh.
|
protected |
the warp model
Definition at line 186 of file ImageAlignment.hh.
|
protected |
Definition at line 193 of file ImageAlignment.hh.
|
protected |
gradients and grey values from image 1
Definition at line 192 of file ImageAlignment.hh.
|
protected |
Definition at line 195 of file ImageAlignment.hh.
|
protected |
Definition at line 194 of file ImageAlignment.hh.