Ocean
Ocean::Tracking::HomographyImageAlignmentDense Class Reference

This class implements functions allowing dense image alignment. More...

Data Structures

class  ConsistencyData
 Definition of an abstract base class allowing to store consistency data. More...
 
class  DenseAdditiveHomographyProvider
 
class  DenseInverseCompositionalHomographyProvider
 
class  HomographyProvider
 

Public Types

typedef ObjectRef< ConsistencyDataConsistencyDataRef
 Definition of an object reference holding a consistency data object. More...
 

Static Public Member Functions

static bool optimizeAlignmentAdditive (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &currentFrame, const SquareMatrix3 &roughHomography, const unsigned int homographyParameters, const bool zeroMean, SquareMatrix3 &homography, const unsigned int iterations=20u, Scalar lambda=10, const Scalar lambdaFactor=10, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr, ConsistencyDataRef *externalConsistencyData=nullptr, bool *abort=nullptr)
 Optimizes the alignment between two images within a specified sub-region regarding a homography by application of an iterative additive delta Levenberg-Marquardt optimization approach. More...
 
static bool optimizeAlignmentInverseCompositional (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &currentFrame, const SquareMatrix3 &roughHomography, const unsigned int homographyParameters, const bool zeroMean, SquareMatrix3 &homography, const unsigned int iterations=20u, Scalar lambda=10, const Scalar lambdaFactor=10, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr, ConsistencyDataRef *externalConsistencyData=nullptr, bool *abort=nullptr)
 Optimizes the alignment between two images within a specified sub-region regarding a homography by application of an iterative inverse compositional delta Levenberg-Marquardt optimization approach. More...
 
static bool optimizeAlignmentMultiResolution (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &currentFrame, const unsigned int numberPyramidLayers, const unsigned int homographyParameters, const bool additiveAlignment, const bool levenbergMarquardtOptimization, const bool zeroMean, const SquareMatrix3 &roughHomography, SquareMatrix3 &homography, const unsigned int coarseIterations=20u, const unsigned int fineIterations=4u, const CV::FramePyramid::DownsamplingMode downsamplingMode=CV::FramePyramid::DM_FILTER_14641)
 Optimizes the alignment between two images within a specified sub-region regarding a homography by applying a multi-resolution (coarse to fine approach) Gauss-Newton or a Levenberg-Marquardt optimization approach. More...
 
static bool optimizeAlignmentMultiResolution (const CV::FramePyramid &templateFramePyramid, const std::vector< CV::SubRegion > &templateSubRegions, const CV::FramePyramid &currentFramePyramid, const unsigned int layers, const unsigned int homographyParameters, const bool additiveAlignment, const bool levenbergMarquardtOptimization, const bool zeroMean, const SquareMatrix3 &roughHomography, SquareMatrix3 &homography, const unsigned int coarseIterations=20u, const unsigned int fineIterations=4u, std::vector< Tracking::HomographyImageAlignmentDense::ConsistencyDataRef > *consistencyDatas=nullptr)
 Optimizes the alignment between two images within a specified sub-region regarding a homography by applying a multi-resolution (coarse to fine approach) Gauss-Newton or a Levenberg-Marquardt optimization approach. More...
 

Static Protected Member Functions

static Scalar slowDetermineError (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &currentFrame, const SquareMatrix3 &homography, const bool zeroMean)
 Determines the current error for a given homography between a current frame and a template frame within a sub-region of the template frame. More...
 
template<unsigned int tChannels>
static Scalar slowDetermineError8BitPerChannel (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &currentFrame, const SquareMatrix3 &homography, const bool zeroMean)
 Determines the current error for a given homography between a current frame and a template frame within a sub-region of the template frame. More...
 
template<unsigned int tParameters>
static bool slowDetermineHessianAndErrorJacobian (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &currentFrame, const SquareMatrix3 &homography, const bool zeroMean, Matrix &hessian, Matrix &jacobianError)
 Determines the 8x8 or 9x9 Hessian matrix and the 8x1 or 9x1 Jacobian-Error vector for a given homography between a current frame and a template frame within a sub-region of the template frame. More...
 
template<unsigned int tParameters, unsigned int tChannels>
static bool slowDetermineHessianAndErrorJacobian8BitPerChannel (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &currentFrame, const SquareMatrix3 &homography, const bool zeroMean, Matrix &hessian, Matrix &jacobianError)
 Determines the 8x8 or 9x9 Hessian matrix and the 8x1 or 9x1 Jacobian-Error vector for a given homography between a current frame and a template frame within a sub-region of the template frame. More...
 
template<unsigned int tChannels, bool tDetermineTemplateMeans>
static bool determineMeans8BitPerChannel (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &transformedCurrentSubFrame, const Frame &transformedCurrentSubFrameMask, Scalar *templateMeans, Scalar *currentMeans, Worker *worker)
 Determines the mean color intensities in the corresponding sub-regions of the current transformed frame and also optional in the template frame while optional a mask frame defines valid and invalid pixels (not counting for error determination). More...
 
template<unsigned int tChannels, bool tUseMeans>
static Scalar determineError8BitPerChannel (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &transformedCurrentSubFrameData, const Frame &transformedCurrentSubFrameMaskData, const Scalar *templateMeans, const Scalar *currentMeans, Worker *worker)
 Determines the color intensity error within a sub-region between a template frame and a transformed current frame while optional a mask frame defines valid and invalid pixels (not counting for error determination). More...
 
template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void determineHessianAndErrorJacobian8BitPerChannel (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &transformedCurrentSubFrame, const Frame &transformedCurrentSubFrameMask, const unsigned int transformedBoundingBoxLeft, const unsigned int transformedBoundingBoxTop, const unsigned int transformedBoundingBoxWidth, const unsigned int transformedBoundingBoxHeight, const Frame &gradientCurrentFrame, const SquareMatrix3 &homography, const Scalar *templateMeans, const Scalar *currentMeans, Matrix &hessian, Matrix &jacobianError, Worker *worker)
 Determines the Hessian matrix and the product of transposed Jacobian matrix and error vector for a template frame and current transformed frame within a sub-region while optional a mask frame defines valid and invalid pixels (not counting for error determination). More...
 
template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void determineErrorJacobianInverseCompositional8BitPerChannel (const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame &transformedCurrentSubFrame, const Frame &transformedCurrentSubFrameMask, const Scalar *templateMeans, const Scalar *currentMeans, const Scalar *jacobianRows, Matrix &jacobianError, Worker *worker)
 Determines the product of transposed Jacobian matrix and error vector for the inverse compositional optimization approach for a template frame and current transformed frame within a sub-region while optional a mask frame defines valid and invalid pixels (not counting for error determination). More...
 
template<unsigned int tChannels, bool tDetermineTemplateMeans>
static void determineMeans8BitPerChannelSubset (const Frame *templateFrame, const CV::SubRegion *templateSubRegion, const Frame *transformedCurrentSubFrame, Scalar *templateMeans, Scalar *currentMeans, unsigned int *templateMeansDenominator, unsigned int *currentMeansDenominator, Lock *lock, const unsigned int threads, const unsigned int threadIndex, const unsigned int unused)
 Determines the mean color intensities in a subset of the corresponding sub-regions of the current transformed frame and also optional in the template frame. More...
 
template<unsigned int tChannels, bool tDetermineTemplateMeans>
static void determineMeansMask8BitPerChannelSubset (const Frame *templateFrame, const CV::SubRegion *templateSubRegion, const Frame *transformedCurrentSubFrame, const Frame *transformedCurrentSubFrameMask, Scalar *templateMeans, Scalar *currentMeans, unsigned int *templateMeansDenominator, unsigned int *currentMeansDenominator, Lock *lock, const unsigned int threads, const unsigned int threadIndex, const unsigned int unused)
 Determines the mean color intensities in a subset of the corresponding sub-regions of the current transformed frame and also optional in the template frame. More...
 
template<unsigned int tChannels, bool tUseMeans>
static void determineError8BitPerChannelSubset (const Frame *templateFrame, const CV::SubRegion *templateSubRegion, const Frame *transformedCurrentSubFrame, const Scalar *templateMeans, const Scalar *currentMeans, Scalar *squaredError, unsigned int *errorDenominators, Lock *lock, const unsigned int threads, const unsigned int threadIndex, const unsigned int unused)
 Determines the color intensity error in a subset of a sub-region between a template frame and a transformed current frame. More...
 
template<unsigned int tChannels, bool tUseMeans>
static void determineErrorMask8BitPerChannelSubset (const Frame *templateFrame, const CV::SubRegion *templateSubRegion, const Frame *transformedCurrentSubFrame, const Frame *transformedCurrentSubFrameMask, const Scalar *templateMeans, const Scalar *currentMeans, Scalar *squaredError, unsigned int *errorDenominators, Lock *lock, const unsigned int threads, const unsigned int threadIndex, const unsigned int unused)
 Determines the color intensity error in a subset of a sub-region between a template frame and a transformed current frame while a mask frame defines valid and invalid pixels (not counting for error determination). More...
 
template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void determineHessianAndErrorJacobian8BitPerChannelSubset (const Frame *templateFrame, const CV::SubRegion *templateSubRegion, const Frame *transformedCurrentSubFrame, const unsigned int transformedBoundingBoxLeft, const unsigned int transformedBoundingBoxTop, const unsigned int transformedBoundingBoxWidth, const unsigned int transformedBoundingBoxHeight, const Frame *gradientCurrentFrame, const SquareMatrix3 *homography, const Scalar *templateMeans, const Scalar *currentMeans, Matrix *hessian, Matrix *jacobianError, Lock *lock, const unsigned int threads, const unsigned int threadIndex, const unsigned int unused)
 Determines the subset-Hessian matrix and the subset-product of transposed Jacobian matrix and error vector for a template frame and current transformed frame within a sub-region. More...
 
template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void determineErrorJacobianInverseCompositional8BitPerChannelSubset (const Frame *templateFrame, const CV::SubRegion *templateSubRegion, const Frame *transformedCurrentSubFrame, const Scalar *templateMeans, const Scalar *currentMeans, const Scalar *jacobianRows, Matrix *jacobianError, Lock *lock, const unsigned int threads, const unsigned int threadIndex, const unsigned int unused)
 Determines the subset of the product of transposed Jacobian matrix and error vector for the inverse compositional optimization approach for a template frame and current transformed frame within a sub-region while optional a mask frame defines valid and invalid pixels (not counting for error determination). More...
 
template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void determineHessianAndErrorJacobianMask8BitPerChannelSubset (const Frame *templateFrame, const CV::SubRegion *templateSubRegion, const Frame *transformedCurrentSubFrame, const Frame *transformedCurrentSubFrameMask, const unsigned int transformedBoundingBoxLeft, const unsigned int transformedBoundingBoxTop, const unsigned int transformedBoundingBoxWidth, const unsigned int transformedBoundingBoxHeight, const Frame *gradientCurrentFrame, const SquareMatrix3 *current_H_template, const Scalar *templateMeans, const Scalar *currentMeans, Matrix *hessian, Matrix *jacobianError, Lock *lock, const unsigned int threads, const unsigned int threadIndex, const unsigned int unused)
 Determines the subset-Hessian matrix and the subset-product of transposed Jacobian matrix and error vector for a template frame and current transformed frame within a sub-region. More...
 

Detailed Description

This class implements functions allowing dense image alignment.

Member Typedef Documentation

◆ ConsistencyDataRef

Definition of an object reference holding a consistency data object.

Member Function Documentation

◆ determineError8BitPerChannel()

template<unsigned int tChannels, bool tUseMeans>
Scalar Ocean::Tracking::HomographyImageAlignmentDense::determineError8BitPerChannel ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrameData,
const Frame transformedCurrentSubFrameMaskData,
const Scalar templateMeans,
const Scalar currentMeans,
Worker worker 
)
inlinestaticprotected

Determines the color intensity error within a sub-region between a template frame and a transformed current frame while optional a mask frame defines valid and invalid pixels (not counting for error determination).

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe frame data of the template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameDataThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedCurrentSubFrameMaskDataOptional mask that has been created during the creation of the sub-region of the transformed current frame, nullptr to avoid the usage of a mask which is more efficient
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
workerOptional worker object to distribute the computation
Returns
The average squared error for each pixel in the sub-region
Template Parameters
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineError8BitPerChannelSubset()

template<unsigned int tChannels, bool tUseMeans>
static void Ocean::Tracking::HomographyImageAlignmentDense::determineError8BitPerChannelSubset ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Scalar templateMeans,
const Scalar currentMeans,
Scalar squaredError,
unsigned int *  errorDenominators,
Lock lock,
const unsigned int  threads,
const unsigned int  threadIndex,
const unsigned int  unused 
)
staticprotected

Determines the color intensity error in a subset of a sub-region between a template frame and a transformed current frame.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
squaredErrorThe resulting sum of squared errors, must be initialized with 0
errorDenominatorsThe number of pixels that have been used to determine the error, must be initialized with 0
lockThe lock object necessary if this function is executed on multiple threads in parallel, nullptr otherwise
threadsThe number of threads on which this function is executed in parallel
threadIndexThe index of the current thread, with range [0, threads)
unusedAn unused parameter must be 1
Template Parameters
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineErrorJacobianInverseCompositional8BitPerChannel()

template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
void Ocean::Tracking::HomographyImageAlignmentDense::determineErrorJacobianInverseCompositional8BitPerChannel ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Frame transformedCurrentSubFrameMask,
const Scalar templateMeans,
const Scalar currentMeans,
const Scalar jacobianRows,
Matrix jacobianError,
Worker worker 
)
inlinestaticprotected

Determines the product of transposed Jacobian matrix and error vector for the inverse compositional optimization approach for a template frame and current transformed frame within a sub-region while optional a mask frame defines valid and invalid pixels (not counting for error determination).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedCurrentSubFrameMaskOptional mask that has been created during the creation of the sub-region of the transformed current frame, nullptr to avoid the usage of any mask which is more efficient
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
jacobianRowsThe already determine (and constant) Jacobian rows for each pixel and channel of the template sub-region, each row has dimension (1 x tParameters)
jacobianErrorThe resulting product of transposed Jacobian matrix and error vector, with dimension (tParameters x 1)
workerOptional worker object to distribute the computation
Template Parameters
tParametersThe number of parameters that are used to optimize the homography, with range [8, 9]
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineErrorJacobianInverseCompositional8BitPerChannelSubset()

template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void Ocean::Tracking::HomographyImageAlignmentDense::determineErrorJacobianInverseCompositional8BitPerChannelSubset ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Scalar templateMeans,
const Scalar currentMeans,
const Scalar jacobianRows,
Matrix jacobianError,
Lock lock,
const unsigned int  threads,
const unsigned int  threadIndex,
const unsigned int  unused 
)
staticprotected

Determines the subset of the product of transposed Jacobian matrix and error vector for the inverse compositional optimization approach for a template frame and current transformed frame within a sub-region while optional a mask frame defines valid and invalid pixels (not counting for error determination).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
jacobianRowsThe already determine (and constant) Jacobian rows for each pixel and channel of the template sub-region, each row has dimension (1 x tParameters)
jacobianErrorThe resulting product of transposed Jacobian matrix and error vector, with dimension (tParameters x 1), must be initialized with 0
lockThe lock object necessary if this function is executed on multiple threads in parallel, nullptr otherwise
threadsThe number of threads on which this function is executed in parallel
threadIndexThe index of the current thread, with range [0, threads)
unusedAn unused parameter must be 1
Template Parameters
tParametersThe number of parameters that are used to optimize the homography, with range [8, 9]
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineErrorMask8BitPerChannelSubset()

template<unsigned int tChannels, bool tUseMeans>
static void Ocean::Tracking::HomographyImageAlignmentDense::determineErrorMask8BitPerChannelSubset ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Frame transformedCurrentSubFrameMask,
const Scalar templateMeans,
const Scalar currentMeans,
Scalar squaredError,
unsigned int *  errorDenominators,
Lock lock,
const unsigned int  threads,
const unsigned int  threadIndex,
const unsigned int  unused 
)
staticprotected

Determines the color intensity error in a subset of a sub-region between a template frame and a transformed current frame while a mask frame defines valid and invalid pixels (not counting for error determination).

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedCurrentSubFrameMaskThe mask that has been created during the creation of the sub-region of the transformed current frame
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
squaredErrorThe resulting sum of squared errors, must be initialized with 0
errorDenominatorsThe number of pixels that have been used to determine the error, must be initialized with 0
lockThe lock object necessary if this function is executed on multiple threads in parallel, nullptr otherwise
threadsThe number of threads on which this function is executed in parallel
threadIndexThe index of the current thread, with range [0, threads)
unusedAn unused parameter must be 1
Template Parameters
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineHessianAndErrorJacobian8BitPerChannel()

template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
void Ocean::Tracking::HomographyImageAlignmentDense::determineHessianAndErrorJacobian8BitPerChannel ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Frame transformedCurrentSubFrameMask,
const unsigned int  transformedBoundingBoxLeft,
const unsigned int  transformedBoundingBoxTop,
const unsigned int  transformedBoundingBoxWidth,
const unsigned int  transformedBoundingBoxHeight,
const Frame gradientCurrentFrame,
const SquareMatrix3 homography,
const Scalar templateMeans,
const Scalar currentMeans,
Matrix hessian,
Matrix jacobianError,
Worker worker 
)
inlinestaticprotected

Determines the Hessian matrix and the product of transposed Jacobian matrix and error vector for a template frame and current transformed frame within a sub-region while optional a mask frame defines valid and invalid pixels (not counting for error determination).

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedCurrentSubFrameMaskOptional mask that has been created during the creation of the sub-region of the transformed current frame, nullptr to avoid the usage of any mask which is more efficient
transformedBoundingBoxLeftThe left border of the bounding box of the transformed sub-region in pixel, with range [0, currentFrame.width())
transformedBoundingBoxTopthe top border of the bounding box of the transformed sub-region in pixel, with range [0, currentFrame.height())
transformedBoundingBoxWidthThe width of the bounding box of the transformed sub-region in pixel, with range [1, currentFrame.width() - transformedBoundingBoxLeft]
transformedBoundingBoxHeightThe height of the bounding box of the transformed sub-region in pixel, with range [1, currentFrame.height() - transformedBoundingBoxTop]
gradientCurrentFrameThe gradient filter responses of the current frame restricted to the location and size of the transformed bounding box, must be valid
homographyThe homography to be used to transform the current frame with
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
hessianThe resulting Hessian matrix, with dimension (tParameters x tParameters)
jacobianErrorThe resulting product of transposed Jacobian matrix and error vector, with dimension (tParameters x 1)
workerOptional worker object to distribute the computation
Template Parameters
tParametersThe number of parameters that are used to optimize the homography, with range [8, 9]
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineHessianAndErrorJacobian8BitPerChannelSubset()

template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void Ocean::Tracking::HomographyImageAlignmentDense::determineHessianAndErrorJacobian8BitPerChannelSubset ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const unsigned int  transformedBoundingBoxLeft,
const unsigned int  transformedBoundingBoxTop,
const unsigned int  transformedBoundingBoxWidth,
const unsigned int  transformedBoundingBoxHeight,
const Frame gradientCurrentFrame,
const SquareMatrix3 homography,
const Scalar templateMeans,
const Scalar currentMeans,
Matrix hessian,
Matrix jacobianError,
Lock lock,
const unsigned int  threads,
const unsigned int  threadIndex,
const unsigned int  unused 
)
staticprotected

Determines the subset-Hessian matrix and the subset-product of transposed Jacobian matrix and error vector for a template frame and current transformed frame within a sub-region.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedBoundingBoxLeftThe left border of the bounding box of the transformed sub-region in pixel, with range [0, currentFrame.width())
transformedBoundingBoxTopthe top border of the bounding box of the transformed sub-region in pixel, with range [0, currentFrame.height())
transformedBoundingBoxWidthThe width of the bounding box of the transformed sub-region in pixel, with range [1, currentFrame.width() - transformedBoundingBoxLeft]
transformedBoundingBoxHeightThe height of the bounding box of the transformed sub-region in pixel, with range [1, currentFrame.height() - transformedBoundingBoxTop]
gradientCurrentFrameThe gradient filter responses of the current frame restricted to the location and size of the transformed bounding box, must be valid
homographyThe homography to be used to transform the current frame with
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
hessianThe resulting Hessian matrix, with dimension (tParameters x tParameters), must be initialized with 0
jacobianErrorThe resulting product of transposed Jacobian matrix and error vector, with dimension (tParameters x 1), must be initialized with 0
lockThe lock object necessary if this function is executed on multiple threads in parallel, nullptr otherwise
threadsThe number of threads on which this function is executed in parallel
threadIndexThe index of the current thread, with range [0, threads)
unusedAn unused parameter must be 1
Template Parameters
tParametersThe number of parameters that are used to optimize the homography, with range [8, 9]
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineHessianAndErrorJacobianMask8BitPerChannelSubset()

template<unsigned int tParameters, unsigned int tChannels, bool tUseMeans>
static void Ocean::Tracking::HomographyImageAlignmentDense::determineHessianAndErrorJacobianMask8BitPerChannelSubset ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Frame transformedCurrentSubFrameMask,
const unsigned int  transformedBoundingBoxLeft,
const unsigned int  transformedBoundingBoxTop,
const unsigned int  transformedBoundingBoxWidth,
const unsigned int  transformedBoundingBoxHeight,
const Frame gradientCurrentFrame,
const SquareMatrix3 current_H_template,
const Scalar templateMeans,
const Scalar currentMeans,
Matrix hessian,
Matrix jacobianError,
Lock lock,
const unsigned int  threads,
const unsigned int  threadIndex,
const unsigned int  unused 
)
staticprotected

Determines the subset-Hessian matrix and the subset-product of transposed Jacobian matrix and error vector for a template frame and current transformed frame within a sub-region.

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region for which the error is determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedCurrentSubFrameMaskThe mask that has been created during the creation of the sub-region of the transformed current frame
transformedBoundingBoxLeftThe left border of the bounding box of the transformed sub-region in pixel, with range [0, currentFrame.width())
transformedBoundingBoxTopthe top border of the bounding box of the transformed sub-region in pixel, with range [0, currentFrame.height())
transformedBoundingBoxWidthThe width of the bounding box of the transformed sub-region in pixel, with range [1, currentFrame.width() - transformedBoundingBoxLeft]
transformedBoundingBoxHeightThe height of the bounding box of the transformed sub-region in pixel, with range [1, currentFrame.height() - transformedBoundingBoxTop]
gradientCurrentFrameThe gradient filter responses of the current frame restricted to the location and size of the transformed bounding box, must be valid
current_H_templateThe homography converting the template image to the current image, must be valid
templateMeansThe mean color intensities in the sub-region of the template frame, must be defined if 'tUseMeans' is True; otherwise nullptr
currentMeansThe mean color intensities in the current transformed frame, must be defined if 'tUseMeans' is True; otherwise nullptr
hessianThe resulting Hessian matrix, with dimension (tParameters x tParameters), must be initialized with 0
jacobianErrorThe resulting product of transposed Jacobian matrix and error vector, with dimension (tParameters x 1), must be initialized with 0
lockThe lock object necessary if this function is executed on multiple threads in parallel, nullptr otherwise
threadsThe number of threads on which this function is executed in parallel
threadIndexThe index of the current thread, with range [0, threads)
unusedAn unused parameter must be 1
Template Parameters
tParametersThe number of parameters that are used to optimize the homography, with range [8, 9]
tChannelsThe number of data channels of the provided frames
tUseMeansTrue, if the mean color intensities are used to determine the errors; False, otherwise

◆ determineMeans8BitPerChannel()

template<unsigned int tChannels, bool tDetermineTemplateMeans>
bool Ocean::Tracking::HomographyImageAlignmentDense::determineMeans8BitPerChannel ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Frame transformedCurrentSubFrameMask,
Scalar templateMeans,
Scalar currentMeans,
Worker worker 
)
inlinestaticprotected

Determines the mean color intensities in the corresponding sub-regions of the current transformed frame and also optional in the template frame while optional a mask frame defines valid and invalid pixels (not counting for error determination).

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region in which the mean color intensities are determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedCurrentSubFrameMaskOptional mask that has been created during the creation of the sub-region of the transformed current frame, nullptr to avoid the usage of any mask which is more efficient
templateMeansThe resulting mean color intensities in the template frame, if 'tDetermineTemplateMeans' is True
currentMeansThe resulting mean color intensities in the current transformed frame
workerOptional worker object to distribute the computation
Returns
True, if succeeded
Template Parameters
tChannelsThe number of data channels of the provided frames
tDetermineTemplateMeansTrue, to determine the mean intensities for the current frame and the template frame; False, to determine the mean intensities for the current frame only

◆ determineMeans8BitPerChannelSubset()

template<unsigned int tChannels, bool tDetermineTemplateMeans>
static void Ocean::Tracking::HomographyImageAlignmentDense::determineMeans8BitPerChannelSubset ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
Scalar templateMeans,
Scalar currentMeans,
unsigned int *  templateMeansDenominator,
unsigned int *  currentMeansDenominator,
Lock lock,
const unsigned int  threads,
const unsigned int  threadIndex,
const unsigned int  unused 
)
staticprotected

Determines the mean color intensities in a subset of the corresponding sub-regions of the current transformed frame and also optional in the template frame.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region in which the mean color intensities are determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
templateMeansThe resulting sum of color intensities in the template frame, if 'tDetermineTemplateMeans' is True, must be initialized with 0
currentMeansThe resulting sum of color intensities in the current transformed frame, must be initialized with 0
templateMeansDenominatorThe number of pixels that have been used to determine the sum of intensities in the template frame, must be initialized with 0
currentMeansDenominatorThe number of pixels that have been used to determine the sum of intensities in the current transformed frame, must be initialized with 0
lockThe lock object necessary if this function is executed on multiple threads in parallel, nullptr otherwise
threadsThe number of threads on which this function is executed in parallel
threadIndexThe index of the current thread, with range [0, threads)
unusedAn unused parameter must be 1
Template Parameters
tChannelsThe number of data channels of the provided frames
tDetermineTemplateMeansTrue, to determine the mean intensities for the current frame and the template frame; False, to determine the mean intensities for the current frame only
See also
determineMeans8BitPerChannel().

◆ determineMeansMask8BitPerChannelSubset()

template<unsigned int tChannels, bool tDetermineTemplateMeans>
static void Ocean::Tracking::HomographyImageAlignmentDense::determineMeansMask8BitPerChannelSubset ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame transformedCurrentSubFrame,
const Frame transformedCurrentSubFrameMask,
Scalar templateMeans,
Scalar currentMeans,
unsigned int *  templateMeansDenominator,
unsigned int *  currentMeansDenominator,
Lock lock,
const unsigned int  threads,
const unsigned int  threadIndex,
const unsigned int  unused 
)
staticprotected

Determines the mean color intensities in a subset of the corresponding sub-regions of the current transformed frame and also optional in the template frame.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region in which the mean color intensities are determined, defined in the template frame
transformedCurrentSubFrameThe sub-region from the transformed current frame, needs to be transformed with the homography with size and location equal to the sub-region
transformedCurrentSubFrameMaskThe mask that has been created during the creation of the sub-region of the transformed current frame
templateMeansThe resulting sum of color intensities in the template frame, if 'tDetermineTemplateMeans' is True, must be initialized with 0
currentMeansThe resulting sum of color intensities in the current transformed frame, must be initialized with 0
templateMeansDenominatorThe number of pixels that have been used to determine the sum of intensities in the template frame, must be initialized with 0
currentMeansDenominatorThe number of pixels that have been used to determine the sum of intensities in the current transformed frame, must be initialized with 0
lockThe lock object necessary if this function is executed on multiple threads in parallel, nullptr otherwise
threadsThe number of threads on which this function is executed in parallel
threadIndexThe index of the current thread, with range [0, threads)
unusedAn unused parameter must be 1
Template Parameters
tChannelsThe number of data channels of the provided frames
tDetermineTemplateMeansTrue, to determine the mean intensities for the current frame and the template frame; False, to determine the mean intensities for the current frame only
See also
determineMeans8BitPerChannel().

◆ optimizeAlignmentAdditive()

static bool Ocean::Tracking::HomographyImageAlignmentDense::optimizeAlignmentAdditive ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame currentFrame,
const SquareMatrix3 roughHomography,
const unsigned int  homographyParameters,
const bool  zeroMean,
SquareMatrix3 homography,
const unsigned int  iterations = 20u,
Scalar  lambda = 10,
const Scalar  lambdaFactor = 10,
Scalar initialError = nullptr,
Scalar finalError = nullptr,
Scalars intermediateErrors = nullptr,
ConsistencyDataRef externalConsistencyData = nullptr,
bool *  abort = nullptr 
)
static

Optimizes the alignment between two images within a specified sub-region regarding a homography by application of an iterative additive delta Levenberg-Marquardt optimization approach.

The resulting homography converts points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint), the given rough homography must be defined accordingly.
The performance of this function can be improved further if this function is invoked successively for the same template frame with identical parameters but with individual current frames.
In this case, an empty consistency data object must be provided for the first call, stored outside and must again be provided for the successive calls.

Parameters
templateFrameThe template frame defining the reference to which the current frame will be aligned, must be valid
templateSubRegionThe sub-region defined within the template frame from which the visual content is used for the alignment, image content outside the sub-region is not investigated, must be valid
currentFrameThe current frame for which the alignment will be determine, must have the same pixel format and pixel origin as the template frame
roughHomographyAn already rough homography defining the alignment between template and current frame, the homography transforms points defined in the template frame to points defined in the current frame
homographyParametersThe number of parameters used to define the homography, with range [8, 9]
zeroMeanTrue, to subtract the color intensities from the corresponding mean intensity before determining the error; False, to determine the error directly
homographyThe resulting optimized homography for the specified template frame and current frame, with 1 in the lower right corner
iterationsThe number of optimization iterations that will be applied at most, with range [1, infinity)
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting initial averaged squared error between template and current frame within the sub-region
finalErrorOptional resulting final averaged squared error between template and current frame within the sub-region
intermediateErrorsOptional resulting intermediate averaged squared errors, on error for each improving optimization iteration
abortOptional abort statement allowing to abort the alignment at any time; set the value True to abort the alignment
externalConsistencyDataOptional abstract consistency data object that may be used to improve the overall performance for several successive optimization calls for individual current frames but with the same template frame
See also
optimizeAlignmentInverseCompositional(), optimizeAlignmentMultiResolution().

◆ optimizeAlignmentInverseCompositional()

static bool Ocean::Tracking::HomographyImageAlignmentDense::optimizeAlignmentInverseCompositional ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame currentFrame,
const SquareMatrix3 roughHomography,
const unsigned int  homographyParameters,
const bool  zeroMean,
SquareMatrix3 homography,
const unsigned int  iterations = 20u,
Scalar  lambda = 10,
const Scalar  lambdaFactor = 10,
Scalar initialError = nullptr,
Scalar finalError = nullptr,
Scalars intermediateErrors = nullptr,
ConsistencyDataRef externalConsistencyData = nullptr,
bool *  abort = nullptr 
)
static

Optimizes the alignment between two images within a specified sub-region regarding a homography by application of an iterative inverse compositional delta Levenberg-Marquardt optimization approach.

The resulting homography converts points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint), the given rough homography must be defined accordingly.
The performance of this function can be improved further if this function is invoked successively for the same template frame with identical parameters but with individual current frames.
In this case, an empty consistency data object must be provided for the first call, stored outside and must again be provided for the successive calls.

Parameters
templateFrameThe template frame defining the reference to which the current frame will be aligned, must be valid
templateSubRegionThe sub-region defined within the template frame from which the visual content is used for the alignment, image content outside the sub-region is not investigated, must be valid
currentFrameThe current frame for which the alignment will be determine, must have the same pixel format and pixel origin as the template frame
roughHomographyAn already rough homography defining the alignment between template and current frame, the homography transforms points defined in the template frame to points defined in the current frame
homographyParametersThe number of parameters used to define the homography, with range [8, 9]
zeroMeanTrue, to subtract the color intensities from the corresponding mean intensity before determining the error; False, to determine the error directly
homographyThe resulting optimized homography for the specified template frame and current frame, with 1 in the lower right corner
iterationsThe number of optimization iterations that will be applied at most, with range [1, infinity)
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting initial averaged squared error between template and current frame within the sub-region
finalErrorOptional resulting final averaged squared error between template and current frame within the sub-region
intermediateErrorsOptional resulting intermediate averaged squared errors, on error for each improving optimization iteration
abortOptional abort statement allowing to abort the alignment at any time; set the value True to abort the alignment
externalConsistencyDataOptional abstract consistency data object that may be used to improve the overall performance for several successive optimization calls for individual current frames but with the same template frame
See also
optimizeAlignmentAdditive(), optimizeAlignmentMultiResolution().

◆ optimizeAlignmentMultiResolution() [1/2]

static bool Ocean::Tracking::HomographyImageAlignmentDense::optimizeAlignmentMultiResolution ( const CV::FramePyramid templateFramePyramid,
const std::vector< CV::SubRegion > &  templateSubRegions,
const CV::FramePyramid currentFramePyramid,
const unsigned int  layers,
const unsigned int  homographyParameters,
const bool  additiveAlignment,
const bool  levenbergMarquardtOptimization,
const bool  zeroMean,
const SquareMatrix3 roughHomography,
SquareMatrix3 homography,
const unsigned int  coarseIterations = 20u,
const unsigned int  fineIterations = 4u,
std::vector< Tracking::HomographyImageAlignmentDense::ConsistencyDataRef > *  consistencyDatas = nullptr 
)
static

Optimizes the alignment between two images within a specified sub-region regarding a homography by applying a multi-resolution (coarse to fine approach) Gauss-Newton or a Levenberg-Marquardt optimization approach.

The resulting homography converts points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint), the given rough homography must be defined accordingly.
The performance of this function can be improved further if this function is invoked successively for the same template frame with identical parameters but with individual current frames.
In this case, an empty consistency data object must be provided for the first call, stored outside and must again be provided for the successive calls.

Parameters
templateFramePyramidThe pyramid frame of the template frame
templateSubRegionsThe multi-resolution sub-regions defined in the template frames (one sub-region for each pyramid-layer)
currentFramePyramidThe pyramid frame of the current frame, must have the same pixel format, pixel origin and layer number as the pyramid of the template frame
layersThe number of pyramid layers to be used for the alignment, with range [1, min(templateFramePyramid.layers(), currentFramePyramid.layers()]
homographyParametersThe number of parameters representing the homography with range [8, 9]
additiveAlignmentTrue, to apply the additive delta optimization; False, to apply the inverse compositional delta optimization
levenbergMarquardtOptimizationTrue, to apply the Levenberg-Marquardt optimization; False, to apply Gauss-Newton
zeroMeanTrue, to apply a zero-mean optimization (color intensities will be subtracted from the mean color intensity); False, to use the color intensities directly
roughHomographyThe rough homography already known between the template frame and the current frame (currentPoint = H * templatePoint)
homographyThe resulting precise homography
coarseIterationsThe number of optimization iterations that will be applied at most on the coarsest pyramid layer, with range [1, infinity)
fineIterationsThe number of optimization iterations that will be applied at most on the finest pyramid layer, the layers between coarsest and finest layer will be handled by a linear interpolation between both iteration values, with range [1, infinity)
consistencyDatasThe optional consistency data objects to improve the optimization performance, either no objects or one object per pyramid layer
Returns
True, if succeeded
See also
optimizeAlignmentAdditive(), optimizeAlignmentInverseCompositional().

◆ optimizeAlignmentMultiResolution() [2/2]

static bool Ocean::Tracking::HomographyImageAlignmentDense::optimizeAlignmentMultiResolution ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame currentFrame,
const unsigned int  numberPyramidLayers,
const unsigned int  homographyParameters,
const bool  additiveAlignment,
const bool  levenbergMarquardtOptimization,
const bool  zeroMean,
const SquareMatrix3 roughHomography,
SquareMatrix3 homography,
const unsigned int  coarseIterations = 20u,
const unsigned int  fineIterations = 4u,
const CV::FramePyramid::DownsamplingMode  downsamplingMode = CV::FramePyramid::DM_FILTER_14641 
)
static

Optimizes the alignment between two images within a specified sub-region regarding a homography by applying a multi-resolution (coarse to fine approach) Gauss-Newton or a Levenberg-Marquardt optimization approach.

The resulting homography converts points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint), the given rough homography must be defined accordingly.
The performance of this function can be improved further if this function is invoked successively for the same template frame with identical parameters but with individual current frames.
In this case, an empty consistency data object must be provided for the first call, stored outside and must again be provided for the successive calls.

Parameters
templateFrameThe template frame, must be valid
templateSubRegionThe sub-region defined in the template frames, must be valid
currentFrameThe current frame, must have the same pixel format, pixel origin and layer number as the pyramid of the template frame, must be valid
numberPyramidLayersThe number of pyramid layers to be used, with range [1, infinity)
homographyParametersThe number of parameters representing the homography with range [8, 9]
additiveAlignmentTrue, to apply the additive delta optimization; False, to apply the inverse compositional delta optimization
levenbergMarquardtOptimizationTrue, to apply the Levenberg-Marquardt optimization; False, to apply Gauss-Newton
zeroMeanTrue, to apply a zero-mean optimization (color intensities will be subtracted from the mean color intensity); False, to use the color intensities directly
roughHomographyThe rough homography already known between the template frame and the current frame (currentPoint = H * templatePoint)
homographyThe resulting precise homography
coarseIterationsThe number of optimization iterations that will be applied at most on the coarsest pyramid layer, with range [1, infinity)
fineIterationsThe number of optimization iterations that will be applied at most on the finest pyramid layer, the layers between coarsest and finest layer will be handled by a linear interpolation between both iteration values, with range [1, infinity)
downsamplingModeThe down-sampling mode that is applied to create the pyramid layers
Returns
True, if succeeded
See also
optimizeAlignmentAdditive(), optimizeAlignmentInverseCompositional().

◆ slowDetermineError()

static Scalar Ocean::Tracking::HomographyImageAlignmentDense::slowDetermineError ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame currentFrame,
const SquareMatrix3 homography,
const bool  zeroMean 
)
staticprotected

Determines the current error for a given homography between a current frame and a template frame within a sub-region of the template frame.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).
We keep this implementation for debugging and for better understanding of the overall algorithm.

Parameters
templateFrameThe template frame for which the error is determined, with 8 bit per pixel and 1-4 channels
templateSubRegionThe sub-region defined within the template frame
currentFrameThe current frame for which the error is determined, must have the same pixel format and pixel origin as the template frame
homographyThe homography for which the error is determined, transforming points defined in the template frame to points defined in the current frame, with 1 in the lower right corner
zeroMeanTrue, to subtract the color intensities from the corresponding mean intensity before determining the error; False, to determine the error directly
Returns
The resulting average squared error for all valid pixel correspondences

◆ slowDetermineError8BitPerChannel()

template<unsigned int tChannels>
static Scalar Ocean::Tracking::HomographyImageAlignmentDense::slowDetermineError8BitPerChannel ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame currentFrame,
const SquareMatrix3 homography,
const bool  zeroMean 
)
staticprotected

Determines the current error for a given homography between a current frame and a template frame within a sub-region of the template frame.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).
We keep this implementation for debugging and for better understanding of the overall algorithm.

Parameters
templateFrameThe template frame for which the error is determined, with 8 bit per pixel and 1-4 channels
templateSubRegionThe sub-region defined within the template frame
currentFrameThe current frame for which the error is determined, must have the same pixel format and pixel origin as the template frame
homographyThe homography for which the error is determined, transforming points defined in the template frame to points defined in the current frame, with 1 in the lower right corner
zeroMeanTrue, to subtract the color intensities from the corresponding mean intensity before determining the error; False, to determine the error directly
Returns
The resulting average squared error for all valid pixel correspondences
Template Parameters
tChannelsThe number of channels both frames have, with range [1, 4]

◆ slowDetermineHessianAndErrorJacobian()

template<unsigned int tParameters>
static bool Ocean::Tracking::HomographyImageAlignmentDense::slowDetermineHessianAndErrorJacobian ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame currentFrame,
const SquareMatrix3 homography,
const bool  zeroMean,
Matrix hessian,
Matrix jacobianError 
)
staticprotected

Determines the 8x8 or 9x9 Hessian matrix and the 8x1 or 9x1 Jacobian-Error vector for a given homography between a current frame and a template frame within a sub-region of the template frame.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).
We keep this implementation for debugging and for better understanding of the overall algorithm.

Parameters
templateFrameThe template frame for which the Hessian and Jacobian is determined, with 8 bit per pixel and 1-4 channels
templateSubRegionThe sub-region defined within the template frame
currentFrameThe current frame for which the Hessian and Jacobian is determined, must have the same pixel format and pixel origin as the template frame
homographyThe homography for which the Hessian and Jacobian is determined, transforming points defined in the template frame to points defined in the current frame, with 1 in the lower right corner
zeroMeanTrue, to subtract the color intensities from the corresponding mean intensity before determining the error; False, to determine the error directly
hessianThe resulting Hessian matrix
jacobianErrorThe resulting Jacobian-Error matrix
Returns
True, if succeeded
Template Parameters
tParametersThe number of parameters describing the homography and used to optimize it, with range [8, 9]

◆ slowDetermineHessianAndErrorJacobian8BitPerChannel()

template<unsigned int tParameters, unsigned int tChannels>
static bool Ocean::Tracking::HomographyImageAlignmentDense::slowDetermineHessianAndErrorJacobian8BitPerChannel ( const Frame templateFrame,
const CV::SubRegion templateSubRegion,
const Frame currentFrame,
const SquareMatrix3 homography,
const bool  zeroMean,
Matrix hessian,
Matrix jacobianError 
)
staticprotected

Determines the 8x8 or 9x9 Hessian matrix and the 8x1 or 9x1 Jacobian-Error vector for a given homography between a current frame and a template frame within a sub-region of the template frame.

The homography transformed points defined in the template frame to points defined in the current frame (currenttPoint = H * templatePoint).
We keep this implementation for debugging and for better understanding of the overall algorithm.

Parameters
templateFrameThe template frame for which the Hessian and Jacobian is determined, with 8 bit per pixel and 1-4 channels
templateSubRegionThe sub-region defined within the template frame
currentFrameThe current frame for which the Hessian and Jacobian is determined, must have the same pixel format and pixel origin as the template frame
homographyThe homography for which the Hessian and Jacobian is determined, transforming points defined in the template frame to points defined in the current frame, with 1 in the lower right corner
hessianThe resulting Hessian matrix
zeroMeanTrue, to subtract the color intensities from the corresponding mean intensity before determining the error; False, to determine the error directly
jacobianErrorThe resulting Jacobian-Error matrix
Returns
True, if succeeded
Template Parameters
tParametersThe number of parameters describing the homography and used to optimize it, with range [8, 9]
tChannelsThe number of channels both frames have, with range [1, 4]

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