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
73e1d64a
Commit
73e1d64a
authored
Sep 27, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6956 from mshabunin:fix-chessboard-bug
parents
f4b84dd4
b8bce552
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
19 deletions
+26
-19
calibinit.cpp
modules/calib3d/src/calibinit.cpp
+0
-0
checkchessboard.cpp
modules/calib3d/src/checkchessboard.cpp
+0
-0
precomp.hpp
modules/calib3d/src/precomp.hpp
+3
-0
test_chesscorners.cpp
modules/calib3d/test/test_chesscorners.cpp
+21
-16
test_calibration.py
modules/python/test/test_calibration.py
+2
-3
No files found.
modules/calib3d/src/calibinit.cpp
View file @
73e1d64a
This diff is collapsed.
Click to expand it.
modules/calib3d/src/checkchessboard.cpp
View file @
73e1d64a
This diff is collapsed.
Click to expand it.
modules/calib3d/src/precomp.hpp
View file @
73e1d64a
...
...
@@ -117,4 +117,7 @@ template<typename T> inline int compressElems( T* ptr, const uchar* mask, int ms
}
int
checkChessboard
(
const
cv
::
Mat
&
img
,
const
cv
::
Size
&
size
);
int
checkChessboardBinary
(
const
cv
::
Mat
&
img
,
const
cv
::
Size
&
size
);
#endif
modules/calib3d/test/test_chesscorners.cpp
View file @
73e1d64a
...
...
@@ -51,29 +51,31 @@ using namespace cv;
#define _L2_ERR
void
show_points
(
const
Mat
&
gray
,
const
Mat
&
u
,
const
vector
<
Point2f
>&
v
,
Size
pattern_size
,
bool
was_found
)
//#define DEBUG_CHESSBOARD
#ifdef DEBUG_CHESSBOARD
#include "opencv2/highgui.hpp"
void
show_points
(
const
Mat
&
gray
,
const
Mat
&
expected
,
const
vector
<
Point2f
>&
actual
,
bool
was_found
)
{
Mat
rgb
(
gray
.
size
(),
CV_8U
);
merge
(
vector
<
Mat
>
(
3
,
gray
),
rgb
);
for
(
size_t
i
=
0
;
i
<
v
.
size
();
i
++
)
circle
(
rgb
,
v
[
i
],
3
,
Scalar
(
255
,
0
,
0
),
FILLED
);
for
(
size_t
i
=
0
;
i
<
actual
.
size
();
i
++
)
circle
(
rgb
,
actual
[
i
],
5
,
Scalar
(
0
,
0
,
200
),
1
,
LINE_AA
);
if
(
!
u
.
empty
()
)
if
(
!
expected
.
empty
()
)
{
const
Point2f
*
u_data
=
u
.
ptr
<
Point2f
>
();
size_t
count
=
u
.
cols
*
u
.
rows
;
const
Point2f
*
u_data
=
expected
.
ptr
<
Point2f
>
();
size_t
count
=
expected
.
cols
*
expected
.
rows
;
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
circle
(
rgb
,
u_data
[
i
],
3
,
Scalar
(
0
,
255
,
0
),
FILLED
);
}
if
(
!
v
.
empty
())
{
Mat
corners
((
int
)
v
.
size
(),
1
,
CV_32FC2
,
(
void
*
)
&
v
[
0
]);
drawChessboardCorners
(
rgb
,
pattern_size
,
corners
,
was_found
);
circle
(
rgb
,
u_data
[
i
],
4
,
Scalar
(
0
,
240
,
0
),
1
,
LINE_AA
);
}
//namedWindow( "test", 0 ); imshow( "test", rgb ); waitKey(0);
putText
(
rgb
,
was_found
?
"FOUND !!!"
:
"NOT FOUND"
,
Point
(
5
,
20
),
FONT_HERSHEY_PLAIN
,
1
,
Scalar
(
0
,
240
,
0
));
imshow
(
"test"
,
rgb
);
while
((
uchar
)
waitKey
(
0
)
!=
'q'
)
{};
}
#else
#define show_points(...)
#endif
enum
Pattern
{
CHESSBOARD
,
CIRCLES_GRID
,
ASYMMETRIC_CIRCLES_GRID
};
...
...
@@ -253,7 +255,6 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
result
=
findCirclesGrid
(
gray
,
pattern_size
,
v
,
CALIB_CB_ASYMMETRIC_GRID
|
algorithmFlags
);
break
;
}
show_points
(
gray
,
Mat
(),
v
,
pattern_size
,
result
);
if
(
result
^
doesContatinChessboard
||
v
.
size
()
!=
count_exp
)
{
...
...
@@ -280,7 +281,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
if
(
pattern
==
CHESSBOARD
)
cornerSubPix
(
gray
,
v
,
Size
(
5
,
5
),
Size
(
-
1
,
-
1
),
TermCriteria
(
TermCriteria
::
EPS
|
TermCriteria
::
MAX_ITER
,
30
,
0.1
));
//find4QuadCornerSubpix(gray, v, Size(5, 5));
show_points
(
gray
,
expected
,
v
,
pattern_size
,
result
);
show_points
(
gray
,
expected
,
v
,
result
);
#ifndef WRITE_POINTS
// printf("called find4QuadCornerSubpix\n");
err
=
calcError
(
v
,
expected
);
...
...
@@ -298,6 +299,10 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
max_precise_error
=
MAX
(
max_precise_error
,
err
);
#endif
}
else
{
show_points
(
gray
,
Mat
(),
v
,
result
);
}
#ifdef WRITE_POINTS
Mat
mat_v
(
pattern_size
,
CV_32FC2
,
(
void
*
)
&
v
[
0
]);
...
...
modules/python/test/test_calibration.py
View file @
73e1d64a
...
...
@@ -57,7 +57,7 @@ class calibration_test(NewOpenCVTests):
eps
=
0.01
normCamEps
=
10.0
normDistEps
=
0.0
01
normDistEps
=
0.0
5
cameraMatrixTest
=
[[
532.80992189
,
0.
,
342.4952186
],
[
0.
,
532.93346422
,
233.8879292
],
...
...
@@ -68,4 +68,4 @@ class calibration_test(NewOpenCVTests):
self
.
assertLess
(
abs
(
rms
-
0.196334638034
),
eps
)
self
.
assertLess
(
cv2
.
norm
(
camera_matrix
-
cameraMatrixTest
,
cv2
.
NORM_L1
),
normCamEps
)
self
.
assertLess
(
cv2
.
norm
(
dist_coefs
-
distCoeffsTest
,
cv2
.
NORM_L1
),
normDistEps
)
\ No newline at end of file
self
.
assertLess
(
cv2
.
norm
(
dist_coefs
-
distCoeffsTest
,
cv2
.
NORM_L1
),
normDistEps
)
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