Skip to content

Commit 9408a5e

Browse files
committed
fix conversion bug in estimateAffine2D* functions
functions support points to have other datatypes than floats. * fix bug in coversion that overwrites src points with dst points
1 parent 383559c commit 9408a5e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

modules/calib3d/src/ptsetreg.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -802,11 +802,11 @@ Mat estimateAffine2D(InputArray _from, InputArray _to, OutputArray _inliers,
802802

803803
if (from.type() != CV_32FC2 || to.type() != CV_32FC2)
804804
{
805-
Mat tmp;
806-
from.convertTo(tmp, CV_32FC2);
807-
from = tmp;
808-
to.convertTo(tmp, CV_32FC2);
809-
to = tmp;
805+
Mat tmp1, tmp2;
806+
from.convertTo(tmp1, CV_32FC2);
807+
from = tmp1;
808+
to.convertTo(tmp2, CV_32FC2);
809+
to = tmp2;
810810
}
811811
// convert to N x 1 vectors
812812
from = from.reshape(2, count);
@@ -869,11 +869,11 @@ Mat estimateAffinePartial2D(InputArray _from, InputArray _to, OutputArray _inlie
869869

870870
if (from.type() != CV_32FC2 || to.type() != CV_32FC2)
871871
{
872-
Mat tmp;
873-
from.convertTo(tmp, CV_32FC2);
874-
from = tmp;
875-
to.convertTo(tmp, CV_32FC2);
876-
to = tmp;
872+
Mat tmp1, tmp2;
873+
from.convertTo(tmp1, CV_32FC2);
874+
from = tmp1;
875+
to.convertTo(tmp2, CV_32FC2);
876+
to = tmp2;
877877
}
878878
// convert to N x 1 vectors
879879
from = from.reshape(2, count);

0 commit comments

Comments
 (0)