Merge pull request #8559 from liquidmetal:feature/utsinh_allocate_ecc

This commit is contained in:
Alexander Alekhin 2017-04-12 08:39:09 +00:00
commit ab9bbf645c
2 changed files with 11 additions and 1 deletions

View File

@ -297,7 +297,7 @@ row is ignored.
Unlike findHomography and estimateRigidTransform, the function findTransformECC implements an Unlike findHomography and estimateRigidTransform, the function findTransformECC implements an
area-based alignment that builds on intensity similarities. In essence, the function updates the 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 initial transformation that roughly aligns the images. If this information is missing, the identity
warp (unity matrix) should be given as input. Note that if images undergo strong 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 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 (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 content approximately). Use inverse warping in the second image to take an image close to the first

View File

@ -325,6 +325,16 @@ double cv::findTransformECC(InputArray templateImage,
CV_Assert(!src.empty()); CV_Assert(!src.empty());
CV_Assert(!dst.empty()); CV_Assert(!dst.empty());
// If the user passed an un-initialized warpMatrix, initialize to identity
if(map.empty()) {
int rowCount = 2;
if(motionType == MOTION_HOMOGRAPHY)
rowCount = 3;
warpMatrix.create(rowCount, 3, CV_32FC1);
map = warpMatrix.getMat();
map = Mat::eye(rowCount, 3, CV_32F);
}
if( ! (src.type()==dst.type())) if( ! (src.type()==dst.type()))
CV_Error( Error::StsUnmatchedFormats, "Both input images must have the same data type" ); CV_Error( Error::StsUnmatchedFormats, "Both input images must have the same data type" );