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
1e1d7496
Commit
1e1d7496
authored
Mar 29, 2012
by
Ilya Lysenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a test for correctMatches (#1350)
parent
f29912b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
1 deletion
+53
-1
test_cameracalibration.cpp
modules/calib3d/test/test_cameracalibration.cpp
+53
-1
No files found.
modules/calib3d/test/test_cameracalibration.cpp
View file @
1e1d7496
...
...
@@ -1285,6 +1285,9 @@ protected:
virtual
void
triangulate
(
const
Mat
&
P1
,
const
Mat
&
P2
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
points4D
)
=
0
;
virtual
void
correct
(
const
Mat
&
F
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
newPoints1
,
Mat
&
newPoints2
)
=
0
;
void
run
(
int
);
};
...
...
@@ -1539,7 +1542,32 @@ void CV_StereoCalibrationTest::run( int )
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Points reprojected with a matrix Q and points reconstructed by triangulation are different, testcase %d
\n
"
,
testcase
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
}
//check correctMatches
const
float
constraintAccuracy
=
1e-5
;
Mat
newPoints1
,
newPoints2
;
Mat
points1
=
projectedPoints_1
.
t
();
points1
=
points1
.
reshape
(
2
,
1
);
Mat
points2
=
projectedPoints_2
.
t
();
points2
=
points2
.
reshape
(
2
,
1
);
correctMatches
(
F
,
points1
,
points2
,
newPoints1
,
newPoints2
);
Mat
newHomogeneousPoints1
,
newHomogeneousPoints2
;
convertPointsToHomogeneous
(
newPoints1
,
newHomogeneousPoints1
);
convertPointsToHomogeneous
(
newPoints2
,
newHomogeneousPoints2
);
newHomogeneousPoints1
=
newHomogeneousPoints1
.
reshape
(
1
);
newHomogeneousPoints2
=
newHomogeneousPoints2
.
reshape
(
1
);
Mat
typedF
;
F
.
convertTo
(
typedF
,
newHomogeneousPoints1
.
type
());
for
(
int
i
=
0
;
i
<
newHomogeneousPoints1
.
rows
;
++
i
)
{
Mat
error
=
newHomogeneousPoints2
.
row
(
i
)
*
typedF
*
newHomogeneousPoints1
.
row
(
i
).
t
();
CV_Assert
(
error
.
rows
==
1
&&
error
.
cols
==
1
);
if
(
norm
(
error
)
>
constraintAccuracy
)
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Epipolar constraint is violated after correctMatches, testcase %d
\n
"
,
testcase
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
}
}
// rectifyUncalibrated
CV_Assert
(
imgpt1
.
size
()
==
imgpt2
.
size
()
);
...
...
@@ -1636,6 +1664,9 @@ protected:
virtual
void
triangulate
(
const
Mat
&
P1
,
const
Mat
&
P2
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
points4D
);
virtual
void
correct
(
const
Mat
&
F
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
newPoints1
,
Mat
&
newPoints2
);
};
double
CV_StereoCalibrationTest_C
::
calibrateStereoCamera
(
const
vector
<
vector
<
Point3f
>
>&
objectPoints
,
...
...
@@ -1729,6 +1760,17 @@ void CV_StereoCalibrationTest_C::triangulate( const Mat& P1, const Mat& P2,
cvTriangulatePoints
(
&
_P1
,
&
_P2
,
&
_points1
,
&
_points2
,
&
_points4D
);
}
void
CV_StereoCalibrationTest_C
::
correct
(
const
Mat
&
F
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
newPoints1
,
Mat
&
newPoints2
)
{
CvMat
_F
=
F
,
_points1
=
points1
,
_points2
=
points2
;
newPoints1
.
create
(
1
,
points1
.
cols
,
points1
.
type
());
newPoints2
.
create
(
1
,
points2
.
cols
,
points2
.
type
());
CvMat
_newPoints1
=
newPoints1
,
_newPoints2
=
_newPoints2
;
cvCorrectMatches
(
&
_F
,
&
_points1
,
&
_points2
,
&
_newPoints1
,
&
_newPoints2
);
}
//-------------------------------- CV_StereoCalibrationTest_CPP ------------------------------
class
CV_StereoCalibrationTest_CPP
:
public
CV_StereoCalibrationTest
...
...
@@ -1755,6 +1797,9 @@ protected:
virtual
void
triangulate
(
const
Mat
&
P1
,
const
Mat
&
P2
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
points4D
);
virtual
void
correct
(
const
Mat
&
F
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
newPoints1
,
Mat
&
newPoints2
);
};
double
CV_StereoCalibrationTest_CPP
::
calibrateStereoCamera
(
const
vector
<
vector
<
Point3f
>
>&
objectPoints
,
...
...
@@ -1794,6 +1839,13 @@ void CV_StereoCalibrationTest_CPP::triangulate( const Mat& P1, const Mat& P2,
triangulatePoints
(
P1
,
P2
,
points1
,
points2
,
points4D
);
}
void
CV_StereoCalibrationTest_CPP
::
correct
(
const
Mat
&
F
,
const
Mat
&
points1
,
const
Mat
&
points2
,
Mat
&
newPoints1
,
Mat
&
newPoints2
)
{
correctMatches
(
F
,
points1
,
points2
,
newPoints1
,
newPoints2
);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
TEST
(
Calib3d_CalibrateCamera_C
,
regression
)
{
CV_CameraCalibrationTest_C
test
;
test
.
safe_run
();
}
...
...
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