8 #ifndef META_OCEAN_TRACKING_IMAGE_ALIGNMENT_DENSE_H
9 #define META_OCEAN_TRACKING_IMAGE_ALIGNMENT_DENSE_H
85 template <
unsigned int tChannels>
89 template <
unsigned int tChannels>
93 template <
unsigned int tChannels>
120 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);
144 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);
167 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);
190 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);
219 template <
unsigned int tChannels>
236 template <
unsigned int tParameters>
254 template <
unsigned int tParameters,
unsigned int tChannels>
271 template <
unsigned int tChannels,
bool tDetermineTemplateMeans>
272 static inline bool determineMeans8BitPerChannel(
const Frame& templateFrame,
const CV::SubRegion& templateSubRegion,
const Frame& transformedCurrentSubFrame,
const Frame& transformedCurrentSubFrameMask,
Scalar* templateMeans,
Scalar* currentMeans,
Worker* worker);
288 template <
unsigned int tChannels,
bool tUseMeans>
289 static inline Scalar determineError8BitPerChannel(
const Frame& templateFrame,
const CV::SubRegion& templateSubRegion,
const Frame& transformedCurrentSubFrameData,
const Frame& transformedCurrentSubFrameMaskData,
const Scalar* templateMeans,
const Scalar* currentMeans,
Worker* worker);
313 template <
unsigned int tParameters,
unsigned int tChannels,
bool tUseMeans>
314 static inline 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);
331 template <
unsigned int tParameters,
unsigned int tChannels,
bool tUseMeans>
332 static inline 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);
352 template <
unsigned int tChannels,
bool tDetermineTemplateMeans>
353 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);
374 template <
unsigned int tChannels,
bool tDetermineTemplateMeans>
375 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);
394 template <
unsigned int tChannels,
bool tUseMeans>
395 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);
415 template <
unsigned int tChannels,
bool tUseMeans>
416 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);
442 template <
unsigned int tParameters,
unsigned int tChannels,
bool tUseMeans>
443 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);
462 template <
unsigned int tParameters,
unsigned int tChannels,
bool tUseMeans>
463 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);
489 template <
unsigned int tParameters,
unsigned int tChannels,
bool tUseMeans>
490 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);
498 template <
unsigned int tChannels,
bool tDetermineTemplateMeans>
503 ocean_assert(!transformedCurrentSubFrameMask.
isValid() || (transformedCurrentSubFrameMask.
width() == transformedCurrentSubFrame.
width() && transformedCurrentSubFrameMask.
height() == transformedCurrentSubFrame.
height()));
505 for (
unsigned int n = 0u; n < tChannels; ++n)
507 currentMeans[n] =
Scalar(0);
509 if constexpr (tDetermineTemplateMeans)
511 templateMeans[n] =
Scalar(0);
515 unsigned int templateMeansDenominator = 0u;
516 unsigned int currentMeansDenominator = 0u;
522 if (transformedCurrentSubFrameMask.
isValid())
524 worker->
executeFunction(
Worker::Function::createStatic(&determineMeansMask8BitPerChannelSubset<tChannels, tDetermineTemplateMeans>, &templateFrame, &templateSubRegion, &transformedCurrentSubFrame, &transformedCurrentSubFrameMask, templateMeans, currentMeans, &templateMeansDenominator, ¤tMeansDenominator, &lock, worker->
threads(), 0u, 0u), 0u, worker->
threads());
528 worker->
executeFunction(
Worker::Function::createStatic(&determineMeans8BitPerChannelSubset<tChannels, tDetermineTemplateMeans>, &templateFrame, &templateSubRegion, &transformedCurrentSubFrame, templateMeans, currentMeans, &templateMeansDenominator, ¤tMeansDenominator, &lock, worker->
threads(), 0u, 0u), 0u, worker->
threads());
533 if (transformedCurrentSubFrameMask.
isValid())
535 determineMeansMask8BitPerChannelSubset<tChannels, tDetermineTemplateMeans>(&templateFrame, &templateSubRegion, &transformedCurrentSubFrame, &transformedCurrentSubFrameMask, templateMeans, currentMeans, &templateMeansDenominator, ¤tMeansDenominator,
nullptr, 1u, 0u, 1u);
539 determineMeans8BitPerChannelSubset<tChannels, tDetermineTemplateMeans>(&templateFrame, &templateSubRegion, &transformedCurrentSubFrame, templateMeans, currentMeans, &templateMeansDenominator, ¤tMeansDenominator,
nullptr, 1u, 0u, 1u);
543 if (currentMeansDenominator == 0u)
550 for (
unsigned int n = 0u; n < tChannels; ++n)
552 currentMeans[n] *= invCurrentDenominator;
555 if constexpr (tDetermineTemplateMeans)
559 for (
unsigned int n = 0u; n < tChannels; ++n)
561 templateMeans[n] *= invTemplateDenominator;
568 template <
unsigned int tChannels,
bool tUseMeans>
574 unsigned int errorDenominator = 0u;
580 if (transformedCurrentSubFrameMask.
isValid())
582 worker->
executeFunction(
Worker::Function::createStatic(&determineErrorMask8BitPerChannelSubset<tChannels, tUseMeans>, &templateFrame, &templateSubRegion, &transformedCurrentSubFrame, &transformedCurrentSubFrameMask, templateMeans, currentMeans, &errorValue, &errorDenominator, &lock, worker->
threads(), 0u, 0u), 0u, worker->
threads());
586 worker->
executeFunction(
Worker::Function::createStatic(&determineError8BitPerChannelSubset<tChannels, tUseMeans>, &templateFrame, &templateSubRegion, &transformedCurrentSubFrame, templateMeans, currentMeans, &errorValue, &errorDenominator, &lock, worker->
threads(), 0u, 0u), 0u, worker->
threads());
591 if (transformedCurrentSubFrameMask.
isValid())
593 determineErrorMask8BitPerChannelSubset<tChannels, tUseMeans>(&templateFrame, &templateSubRegion, &transformedCurrentSubFrame, &transformedCurrentSubFrameMask, templateMeans, currentMeans, &errorValue, &errorDenominator,
nullptr, 1u, 0u, 1u);
597 determineError8BitPerChannelSubset<tChannels, tUseMeans>(&templateFrame, &templateSubRegion, &transformedCurrentSubFrame, templateMeans, currentMeans, &errorValue, &errorDenominator,
nullptr, 1u, 0u, 1u);
601 if (errorDenominator == 0u)
606 return errorValue /
Scalar(errorDenominator * tChannels);
609 template <
unsigned int tParameters,
unsigned int tChannels,
bool tUseMeans>
610 inline void 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)
612 hessian =
Matrix(tParameters, tParameters,
false);
613 jacobianError =
Matrix(tParameters, 1,
false);
619 if (transformedCurrentSubFrameMask.
isValid())
621 worker->
executeFunction(
Worker::Function::createStatic(&determineHessianAndErrorJacobianMask8BitPerChannelSubset<tParameters, tChannels, tUseMeans>, &templateFrame, &templateSubRegion, &transformedCurrentSubFrame, &transformedCurrentSubFrameMask, transformedBoundingBoxLeft, transformedBoundingBoxTop, transformedBoundingBoxWidth, transformedBoundingBoxHeight, &gradientCurrentFrame, &homography, templateMeans, currentMeans, &hessian, &jacobianError, &lock, worker->
threads(), 0u, 0u), 0u, worker->
threads());
625 worker->
executeFunction(
Worker::Function::createStatic(&determineHessianAndErrorJacobian8BitPerChannelSubset<tParameters, tChannels, tUseMeans>, &templateFrame, &templateSubRegion, &transformedCurrentSubFrame, transformedBoundingBoxLeft, transformedBoundingBoxTop, transformedBoundingBoxWidth, transformedBoundingBoxHeight, &gradientCurrentFrame, &homography, templateMeans, currentMeans, &hessian, &jacobianError, &lock, worker->
threads(), 0u, 0u), 0u, worker->
threads());
630 if (transformedCurrentSubFrameMask.
isValid())
632 determineHessianAndErrorJacobianMask8BitPerChannelSubset<tParameters, tChannels, tUseMeans>(&templateFrame, &templateSubRegion, &transformedCurrentSubFrame, &transformedCurrentSubFrameMask, transformedBoundingBoxLeft, transformedBoundingBoxTop, transformedBoundingBoxWidth, transformedBoundingBoxHeight, &gradientCurrentFrame, &homography, templateMeans, currentMeans, &hessian, &jacobianError,
nullptr, 1u, 0u, 1u);
636 determineHessianAndErrorJacobian8BitPerChannelSubset<tParameters, tChannels, tUseMeans>(&templateFrame, &templateSubRegion, &transformedCurrentSubFrame, transformedBoundingBoxLeft, transformedBoundingBoxTop, transformedBoundingBoxWidth, transformedBoundingBoxHeight, &gradientCurrentFrame, &homography, templateMeans, currentMeans, &hessian, &jacobianError,
nullptr, 1u, 0u, 1u);
641 template <
unsigned int tParameters,
unsigned int tChannels,
bool tUseMeans>
644 jacobianError =
Matrix(tParameters, 1,
false);
650 if (transformedCurrentSubFrameMask.
isValid())
652 ocean_assert(
false &&
"**TODO**");
657 worker->
executeFunction(
Worker::Function::createStatic(&determineErrorJacobianInverseCompositional8BitPerChannelSubset<tParameters, tChannels, tUseMeans>, &templateFrame, &templateSubRegion, &transformedCurrentSubFrame, templateMeans, currentMeans, jacobianRows, &jacobianError, &lock, worker->
threads(), 0u, 0u), 0u, worker->
threads());
662 if (transformedCurrentSubFrameMask.
isValid())
664 ocean_assert(
false &&
"**TODO**");
669 determineErrorJacobianInverseCompositional8BitPerChannelSubset<tParameters, tChannels, tUseMeans>(&templateFrame, &templateSubRegion, &transformedCurrentSubFrame, templateMeans, currentMeans, jacobianRows, &jacobianError,
nullptr, 1u, 0u, 1u);
This class implements a frame pyramid.
Definition: FramePyramid.h:37
DownsamplingMode
Definition of individual down sampling modes.
Definition: FramePyramid.h:44
@ DM_FILTER_14641
Down sampling is realized by a 5x5 Gaussian filter.
Definition: FramePyramid.h:72
This class implement a sub-region either defined by 2D triangles or defined by a binary mask.
Definition: SubRegion.h:32
static Caller< void > createStatic(typename StaticFunctionPointerMaker< void, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass >::Type function)
Creates a new caller container for a static function with no function parameter.
Definition: Caller.h:2876
This class implements Ocean's image class.
Definition: Frame.h:1792
bool isValid() const
Returns whether this frame is valid.
Definition: Frame.h:4448
unsigned int width() const
Returns the width of the frame format in pixel.
Definition: Frame.h:3143
@ DT_UNSIGNED_INTEGER_8
Unsigned 8 bit integer data type (uint8_t).
Definition: Frame.h:41
unsigned int height() const
Returns the height of the frame in pixel.
Definition: Frame.h:3148
unsigned int channels() const
Returns the number of individual channels the frame has.
Definition: Frame.h:3173
DataType dataType() const
Returns the data type of the pixel format of this frame.
Definition: Frame.h:3163
This class implements a recursive lock object.
Definition: Lock.h:31
static constexpr T maxValue()
Returns the max scalar value.
Definition: Numeric.h:3244
This template class implements a object reference with an internal reference counter.
Definition: base/ObjectRef.h:58
Definition of an abstract base class allowing to store consistency data.
Definition: HomographyImageAlignmentDense.h:40
virtual bool isEmpty()=0
Returns whether this object currently does not hold any consistency information.
virtual ~ConsistencyData()=default
Destructs this object.
ConsistencyData & operator=(const ConsistencyData &consistencyData)=delete
Disabled copy operator.
ConsistencyData(const ConsistencyData &consistencyData)=delete
Disabled copy constructor.
ConsistencyData()
Protected default constructor.
Definition: HomographyImageAlignmentDense.h:493
Definition: HomographyImageAlignmentDense.h:90
Definition: HomographyImageAlignmentDense.h:94
Definition: HomographyImageAlignmentDense.h:86
This class implements functions allowing dense image alignment.
Definition: HomographyImageAlignmentDense.h:33
static Scalar slowDetermineError8BitPerChannel(const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame ¤tFrame, const SquareMatrix3 &homography, const bool zeroMean)
Determines the current error for a given homography between a current frame and a template frame with...
static bool slowDetermineHessianAndErrorJacobian(const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame ¤tFrame, 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 homogra...
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 c...
static bool optimizeAlignmentAdditive(const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame ¤tFrame, 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 ap...
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 o...
Definition: HomographyImageAlignmentDense.h:642
static bool optimizeAlignmentInverseCompositional(const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame ¤tFrame, 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 ap...
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 c...
Definition: HomographyImageAlignmentDense.h:569
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 fra...
Definition: HomographyImageAlignmentDense.h:499
static bool optimizeAlignmentMultiResolution(const CV::FramePyramid &templateFramePyramid, const std::vector< CV::SubRegion > &templateSubRegions, const CV::FramePyramid ¤tFramePyramid, 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 ap...
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 te...
Definition: HomographyImageAlignmentDense.h:610
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 tra...
static Scalar slowDetermineError(const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame ¤tFrame, const SquareMatrix3 &homography, const bool zeroMean)
Determines the current error for a given homography between a current frame and a template frame with...
static bool optimizeAlignmentMultiResolution(const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame ¤tFrame, 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 ap...
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 trans...
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 tra...
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 v...
ObjectRef< ConsistencyData > ConsistencyDataRef
Definition of an object reference holding a consistency data object.
Definition: HomographyImageAlignmentDense.h:80
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 trans...
static bool slowDetermineHessianAndErrorJacobian8BitPerChannel(const Frame &templateFrame, const CV::SubRegion &templateSubRegion, const Frame ¤tFrame, 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 homogra...
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 v...
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
unsigned int threads() const
Returns the number of threads this worker uses.
bool executeFunction(const Function &function, const unsigned int first, const unsigned int size, const unsigned int firstIndex=(unsigned int)(-1), const unsigned int sizeIndex=(unsigned int)(-1), const unsigned int minimalIterations=1u, const unsigned int threadIndex=(unsigned int)(-1))
Executes a callback function separable by two function parameters.
float Scalar
Definition of a scalar type.
Definition: Math.h:128
MatrixT< Scalar > Matrix
Definition of the Matrix object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single ...
Definition: Matrix.h:18
std::vector< Scalar > Scalars
Definition of a vector holding Scalar objects.
Definition: Math.h:144
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15