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
2a350b11
Commit
2a350b11
authored
Jul 13, 2016
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed several merge issues
parent
74b83cfc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
calib3d.hpp
modules/calib3d/include/opencv2/calib3d/calib3d.hpp
+0
-9
calibinit.cpp
modules/calib3d/src/calibinit.cpp
+17
-14
No files found.
modules/calib3d/include/opencv2/calib3d/calib3d.hpp
View file @
2a350b11
...
...
@@ -46,12 +46,3 @@
#endif
#include "opencv2/calib3d.hpp"
// Performs a fast check if a chessboard is in the input image. This is a workaround to
// a problem of cvFindChessboardCorners being slow on images with no chessboard.
// This method works using a binary image as input
// - src: input binary image
// - size: chessboard size
// Returns 1 if a chessboard can be in this image and findChessboardCorners should be called,
// 0 if there is no chessboard, -1 in case of error
CVAPI
(
int
)
cvCheckChessboardBinary
(
IplImage
*
src
,
CvSize
size
);
modules/calib3d/src/calibinit.cpp
View file @
2a350b11
...
...
@@ -202,6 +202,8 @@ static void icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0);
static
int
icvCheckBoardMonotony
(
CvPoint2D32f
*
corners
,
CvSize
pattern_size
);
int
cvCheckChessboardBinary
(
IplImage
*
src
,
CvSize
size
);
/***************************************************************************************************/
//COMPUTE INTENSITY HISTOGRAM OF INPUT IMAGE
static
int
icvGetIntensityHistogram
(
unsigned
char
*
pucImage
,
int
iSizeCols
,
int
iSizeRows
,
std
::
vector
<
int
>&
piHist
);
...
...
@@ -515,7 +517,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
//perform new method for checking chessboard using a binary image.
//image is binarised using a threshold dependent on the image histogram
icvBinarizationHistogramBased
(
(
unsigned
char
*
)
cImgSeg
->
imageData
,
cImgSeg
->
width
,
cImgSeg
->
height
);
check_chessboard_result
=
cvCheckChessboardBinary
(
cImgSeg
,
pattern_size
);
int
check_chessboard_result
=
cvCheckChessboardBinary
(
cImgSeg
,
pattern_size
);
if
(
check_chessboard_result
<=
0
)
//fall back to the old method
{
IplImage
_img
;
...
...
@@ -528,16 +530,6 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
}
}
// empiric threshold level
// thresholding performed here and not inside the cycle to save processing time
int
thresh_level
;
if
(
!
(
flags
&
CV_CALIB_CB_ADAPTIVE_THRESH
)
)
{
double
mean
=
cvAvg
(
img
).
val
[
0
];
thresh_level
=
cvRound
(
mean
-
10
);
thresh_level
=
MAX
(
thresh_level
,
10
);
cvThreshold
(
img
,
thresh_img
,
thresh_level
,
255
,
CV_THRESH_BINARY
);
}
// Try our standard "1" dilation, but if the pattern is not found, iterate the whole procedure with higher dilations.
// This is necessary because some squares simply do not separate properly with a single dilation. However,
// we want to use the minimum number of dilations possible since dilations cause the squares to become smaller,
...
...
@@ -550,6 +542,8 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
cvFree
(
&
quads
);
cvFree
(
&
corners
);
int
max_quad_buf_size
=
0
;
//USE BINARY IMAGE COMPUTED USING icvBinarizationHistogramBased METHOD
cvDilate
(
thresh_img_new
,
thresh_img_new
,
0
,
1
);
...
...
@@ -586,8 +580,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
// order the quad corners globally
// maybe delete or add some
PRINTF
(
"Starting ordering of inner quads
\n
"
);
count
=
icvOrderFoundConnectedQuads
(
count
,
quad_group
,
&
quad_count
,
&
quads
,
&
corners
,
pattern_size
,
storage
);
count
=
icvOrderFoundConnectedQuads
(
count
,
quad_group
,
&
quad_count
,
&
quads
,
&
corners
,
pattern_size
,
max_quad_buf_size
,
storage
);
PRINTF
(
"Orig count: %d After ordering: %d
\n
"
,
icount
,
count
);
if
(
count
==
0
)
...
...
@@ -637,6 +630,16 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
// revert to old, slower, method if detection failed
if
(
!
found
)
{
// empiric threshold level
// thresholding performed here and not inside the cycle to save processing time
int
thresh_level
;
if
(
!
(
flags
&
CV_CALIB_CB_ADAPTIVE_THRESH
)
)
{
double
mean
=
cvAvg
(
img
).
val
[
0
];
thresh_level
=
cvRound
(
mean
-
10
);
thresh_level
=
MAX
(
thresh_level
,
10
);
cvThreshold
(
img
,
thresh_img
,
thresh_level
,
255
,
CV_THRESH_BINARY
);
}
for
(
k
=
0
;
k
<
6
;
k
++
)
{
int
max_quad_buf_size
=
0
;
...
...
@@ -669,7 +672,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
}
#ifdef DEBUG_CHESSBOARD
cvCvtColor
(
thresh_img
,
dbg_img
,
CV_GRAY2BGR
);
cvCvtColor
(
thresh_img
,
dbg_img
,
CV_GRAY2BGR
);
#endif
// So we can find rectangles that go to the edge, we draw a white line around the image edge.
...
...
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