mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 05:29:54 +08:00
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
This commit is contained in:
parent
383559c228
commit
9408a5ef5d
@ -802,11 +802,11 @@ Mat estimateAffine2D(InputArray _from, InputArray _to, OutputArray _inliers,
|
|||||||
|
|
||||||
if (from.type() != CV_32FC2 || to.type() != CV_32FC2)
|
if (from.type() != CV_32FC2 || to.type() != CV_32FC2)
|
||||||
{
|
{
|
||||||
Mat tmp;
|
Mat tmp1, tmp2;
|
||||||
from.convertTo(tmp, CV_32FC2);
|
from.convertTo(tmp1, CV_32FC2);
|
||||||
from = tmp;
|
from = tmp1;
|
||||||
to.convertTo(tmp, CV_32FC2);
|
to.convertTo(tmp2, CV_32FC2);
|
||||||
to = tmp;
|
to = tmp2;
|
||||||
}
|
}
|
||||||
// convert to N x 1 vectors
|
// convert to N x 1 vectors
|
||||||
from = from.reshape(2, count);
|
from = from.reshape(2, count);
|
||||||
@ -869,11 +869,11 @@ Mat estimateAffinePartial2D(InputArray _from, InputArray _to, OutputArray _inlie
|
|||||||
|
|
||||||
if (from.type() != CV_32FC2 || to.type() != CV_32FC2)
|
if (from.type() != CV_32FC2 || to.type() != CV_32FC2)
|
||||||
{
|
{
|
||||||
Mat tmp;
|
Mat tmp1, tmp2;
|
||||||
from.convertTo(tmp, CV_32FC2);
|
from.convertTo(tmp1, CV_32FC2);
|
||||||
from = tmp;
|
from = tmp1;
|
||||||
to.convertTo(tmp, CV_32FC2);
|
to.convertTo(tmp2, CV_32FC2);
|
||||||
to = tmp;
|
to = tmp2;
|
||||||
}
|
}
|
||||||
// convert to N x 1 vectors
|
// convert to N x 1 vectors
|
||||||
from = from.reshape(2, count);
|
from = from.reshape(2, count);
|
||||||
|
Loading…
Reference in New Issue
Block a user