mirror of
https://github.com/opencv/opencv.git
synced 2025-07-20 19:17:36 +08:00
If the user passes an empty output matrix, initialize it to identity.
This commit is contained in:
parent
0a63ab36bb
commit
b9c2d88e69
@ -325,6 +325,16 @@ double cv::findTransformECC(InputArray templateImage,
|
||||
CV_Assert(!src.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()))
|
||||
CV_Error( Error::StsUnmatchedFormats, "Both input images must have the same data type" );
|
||||
|
Loading…
Reference in New Issue
Block a user