[][src]Function opencv::video::find_transform_ecc_1

pub fn find_transform_ecc_1(
    template_image: &dyn ToInputArray,
    input_image: &dyn ToInputArray,
    warp_matrix: &mut dyn ToInputOutputArray,
    motion_type: i32,
    criteria: &TermCriteria,
    input_mask: &dyn ToInputArray,
    gauss_filt_size: i32
) -> Result<f64>

Finds the geometric transform (warp) between two images in terms of the ECC criterion EP08 .

Parameters

  • templateImage: single-channel template image; CV_8U or CV_32F array.
  • inputImage: single-channel input image which should be warped with the final warpMatrix in order to provide an image similar to templateImage, same type as templateImage.
  • warpMatrix: floating-point inline formula or inline formula mapping matrix (warp).
  • motionType: parameter, specifying the type of motion:
  • MOTION_TRANSLATION sets a translational motion model; warpMatrix is inline formula with the first inline formula part being the unity matrix and the rest two parameters being estimated.
  • MOTION_EUCLIDEAN sets a Euclidean (rigid) transformation as motion model; three parameters are estimated; warpMatrix is inline formula.
  • MOTION_AFFINE sets an affine motion model (DEFAULT); six parameters are estimated; warpMatrix is inline formula.
  • MOTION_HOMOGRAPHY sets a homography as a motion model; eight parameters are estimated;`warpMatrix` is inline formula.
  • criteria: parameter, specifying the termination criteria of the ECC algorithm; criteria.epsilon defines the threshold of the increment in the correlation coefficient between two iterations (a negative criteria.epsilon makes criteria.maxcount the only termination criterion). Default values are shown in the declaration above.
  • inputMask: An optional mask to indicate valid values of inputImage.
  • gaussFiltSize: An optional value indicating size of gaussian blur filter; (DEFAULT: 5)

The function estimates the optimum transformation (warpMatrix) with respect to ECC criterion (EP08), that is

block formula

where

block formula

(the equation holds with homogeneous coordinates for homography). It returns the final enhanced correlation coefficient, that is the correlation coefficient between the template image and the final warped input image. When a inline formula matrix is given with motionType =0, 1 or 2, the third row is ignored.

Unlike findHomography and estimateRigidTransform, the function findTransformECC implements an area-based alignment that builds on intensity similarities. In essence, the function updates the initial transformation that roughly aligns the images. If this information is missing, the identity warp (unity matrix) is used as an initialization. Note that if images undergo strong displacements/rotations, an initial transformation that roughly aligns the images is necessary (e.g., a simple euclidean/similarity transform that allows for the images showing the same image content approximately). Use inverse warping in the second image to take an image close to the first one, i.e. use the flag WARP_INVERSE_MAP with warpAffine or warpPerspective. See also the OpenCV sample image_alignment.cpp that demonstrates the use of the function. Note that the function throws an exception if algorithm does not converges.

See also

computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography