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
56313594
Commit
56313594
authored
Nov 28, 2010
by
Ethan Rublee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimizing calibration for android
parent
a3dfba36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
Calibration.cpp
android/android-jni/jni/Calibration.cpp
+29
-5
No files found.
android/android-jni/jni/Calibration.cpp
View file @
56313594
...
...
@@ -155,25 +155,49 @@ void saveCameraParams(const string& filename, Size imageSize, Size boardSize, fl
bool
Calibration
::
detectAndDrawChessboard
(
int
idx
,
image_pool
*
pool
)
{
bool
patternfound
=
false
;
Mat
grey
=
pool
->
getGrey
(
idx
);
if
(
grey
.
empty
())
return
false
;
vector
<
Point2f
>
corners
;
IplImage
iplgrey
=
grey
;
if
(
!
cvCheckChessboard
(
&
iplgrey
,
patternsize
))
patternfound
=
cvCheckChessboard
(
&
iplgrey
,
patternsize
);
if
(
!
patternfound
)
return
false
;
bool
patternfound
=
findChessboardCorners
(
grey
,
patternsize
,
corners
);
float
factor
=
grey
.
cols
/
320.0
f
;
if
(
factor
<
1
)
factor
=
1
;
cv
::
Size
r_size
=
cv
::
Size
(
grey
.
cols
/
factor
,
grey
.
rows
/
factor
);
Mat
grey_sub
;
while
(
patternfound
&&
(
r_size
.
width
<
grey
.
size
().
width
))
{
cv
::
resize
(
grey
,
grey_sub
,
r_size
);
patternfound
=
findChessboardCorners
(
grey_sub
,
patternsize
,
corners
);
if
(
patternfound
)
{
r_size
.
width
*=
2
;
r_size
.
height
*=
2
;
}
else
{
return
false
;
}
}
// hopefully if we're going to fail we fail on a smaller size image in the while-loop
patternfound
=
findChessboardCorners
(
grey
,
patternsize
,
corners
);
Mat
img
=
pool
->
getImage
(
idx
);
if
(
corners
.
size
()
<
1
)
return
false
;
cornerSubPix
(
grey
,
corners
,
Size
(
11
,
11
),
Size
(
-
1
,
-
1
),
TermCriteria
(
CV_TERMCRIT_EPS
+
CV_TERMCRIT_ITER
,
30
,
0.1
));
if
(
patternfound
)
{
cornerSubPix
(
grey
,
corners
,
Size
(
11
,
11
),
Size
(
-
1
,
-
1
),
TermCriteria
(
CV_TERMCRIT_EPS
+
CV_TERMCRIT_ITER
,
30
,
0.1
));
imagepoints
.
push_back
(
corners
);
}
drawChessboardCorners
(
img
,
patternsize
,
Mat
(
corners
),
patternfound
);
...
...
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