Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4368f04a
Commit
4368f04a
authored
Apr 06, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14271 from alalek:issue_14259
parents
28925572
b5961cc5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
0 deletions
+98
-0
ptsetreg.cpp
modules/calib3d/src/ptsetreg.cpp
+14
-0
test_affine2d_estimator.cpp
modules/calib3d/test/test_affine2d_estimator.cpp
+42
-0
test_affine_partial2d_estimator.cpp
modules/calib3d/test/test_affine_partial2d_estimator.cpp
+42
-0
No files found.
modules/calib3d/src/ptsetreg.cpp
View file @
4368f04a
...
...
@@ -833,6 +833,13 @@ Mat estimateAffine2D(InputArray _from, InputArray _to, OutputArray _inliers,
to
.
convertTo
(
tmp2
,
CV_32FC2
);
to
=
tmp2
;
}
else
{
// avoid changing of inputs in compressElems() call
from
=
from
.
clone
();
to
=
to
.
clone
();
}
// convert to N x 1 vectors
from
=
from
.
reshape
(
2
,
count
);
to
=
to
.
reshape
(
2
,
count
);
...
...
@@ -900,6 +907,13 @@ Mat estimateAffinePartial2D(InputArray _from, InputArray _to, OutputArray _inlie
to
.
convertTo
(
tmp2
,
CV_32FC2
);
to
=
tmp2
;
}
else
{
// avoid changing of inputs in compressElems() call
from
=
from
.
clone
();
to
=
to
.
clone
();
}
// convert to N x 1 vectors
from
=
from
.
reshape
(
2
,
count
);
to
=
to
.
reshape
(
2
,
count
);
...
...
modules/calib3d/test/test_affine2d_estimator.cpp
View file @
4368f04a
...
...
@@ -152,4 +152,46 @@ TEST_P(EstimateAffine2D, testConversion)
INSTANTIATE_TEST_CASE_P
(
Calib3d
,
EstimateAffine2D
,
Method
::
all
());
// https://github.com/opencv/opencv/issues/14259
TEST
(
EstimateAffine2D
,
issue_14259_dont_change_inputs
)
{
/*const static*/
float
pts0_
[
10
]
=
{
0.0
f
,
0.0
f
,
0.0
f
,
8.0
f
,
4.0
f
,
0.0
f
,
// outlier
8.0
f
,
8.0
f
,
8.0
f
,
0.0
f
};
/*const static*/
float
pts1_
[
10
]
=
{
0.1
f
,
0.1
f
,
0.1
f
,
8.1
f
,
0.0
f
,
4.0
f
,
// outlier
8.1
f
,
8.1
f
,
8.1
f
,
0.1
f
};
Mat
pts0
(
Size
(
1
,
5
),
CV_32FC2
,
(
void
*
)
pts0_
);
Mat
pts1
(
Size
(
1
,
5
),
CV_32FC2
,
(
void
*
)
pts1_
);
Mat
pts0_copy
=
pts0
.
clone
();
Mat
pts1_copy
=
pts1
.
clone
();
Mat
inliers
;
cv
::
Mat
A
=
cv
::
estimateAffine2D
(
pts0
,
pts1
,
inliers
);
for
(
int
i
=
0
;
i
<
pts0
.
rows
;
++
i
)
{
EXPECT_EQ
(
pts0_copy
.
at
<
Vec2f
>
(
i
),
pts0
.
at
<
Vec2f
>
(
i
))
<<
"pts0: i="
<<
i
;
}
for
(
int
i
=
0
;
i
<
pts1
.
rows
;
++
i
)
{
EXPECT_EQ
(
pts1_copy
.
at
<
Vec2f
>
(
i
),
pts1
.
at
<
Vec2f
>
(
i
))
<<
"pts1: i="
<<
i
;
}
EXPECT_EQ
(
0
,
(
int
)
inliers
.
at
<
uchar
>
(
2
));
}
}}
// namespace
modules/calib3d/test/test_affine_partial2d_estimator.cpp
View file @
4368f04a
...
...
@@ -161,4 +161,46 @@ TEST_P(EstimateAffinePartial2D, testConversion)
INSTANTIATE_TEST_CASE_P
(
Calib3d
,
EstimateAffinePartial2D
,
Method
::
all
());
// https://github.com/opencv/opencv/issues/14259
TEST
(
EstimateAffinePartial2D
,
issue_14259_dont_change_inputs
)
{
/*const static*/
float
pts0_
[
10
]
=
{
0.0
f
,
0.0
f
,
0.0
f
,
8.0
f
,
4.0
f
,
0.0
f
,
// outlier
8.0
f
,
8.0
f
,
8.0
f
,
0.0
f
};
/*const static*/
float
pts1_
[
10
]
=
{
0.1
f
,
0.1
f
,
0.1
f
,
8.1
f
,
0.0
f
,
4.0
f
,
// outlier
8.1
f
,
8.1
f
,
8.1
f
,
0.1
f
};
Mat
pts0
(
Size
(
1
,
5
),
CV_32FC2
,
(
void
*
)
pts0_
);
Mat
pts1
(
Size
(
1
,
5
),
CV_32FC2
,
(
void
*
)
pts1_
);
Mat
pts0_copy
=
pts0
.
clone
();
Mat
pts1_copy
=
pts1
.
clone
();
Mat
inliers
;
cv
::
Mat
A
=
cv
::
estimateAffinePartial2D
(
pts0
,
pts1
,
inliers
);
for
(
int
i
=
0
;
i
<
pts0
.
rows
;
++
i
)
{
EXPECT_EQ
(
pts0_copy
.
at
<
Vec2f
>
(
i
),
pts0
.
at
<
Vec2f
>
(
i
))
<<
"pts0: i="
<<
i
;
}
for
(
int
i
=
0
;
i
<
pts1
.
rows
;
++
i
)
{
EXPECT_EQ
(
pts1_copy
.
at
<
Vec2f
>
(
i
),
pts1
.
at
<
Vec2f
>
(
i
))
<<
"pts1: i="
<<
i
;
}
EXPECT_EQ
(
0
,
(
int
)
inliers
.
at
<
uchar
>
(
2
));
}
}}
// namespace
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment