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
b2244f87
Commit
b2244f87
authored
Jun 13, 2010
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved the calibration and select3dobj samples
parent
fa3c6821
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
37 deletions
+37
-37
calibration.cpp
samples/cpp/calibration.cpp
+37
-37
select3dobj.cpp
samples/cpp/select3dobj.cpp
+0
-0
No files found.
samples/cpp/calibration.cpp
View file @
b2244f87
...
...
@@ -9,21 +9,28 @@
using
namespace
cv
;
using
namespace
std
;
// example command line (for copy-n-paste):
// calibration -w 6 -h 8 -s 2 -n 10 -o camera.yml -op -oe [<list_of_views.txt>]
/* The list of views may look as following (discard the starting and ending ------ separators):
-------------------
view000.png
view001.png
#view002.png
view003.png
view010.png
one_extra_view.jpg
-------------------
that is, the file will contain 6 lines, view002.png will not be used for calibration,
other ones will be (those, in which the chessboard pattern will be found)
*/
/*
example command line (for copy-n-paste):
calibration -w 6 -h 8 -s 2 -o camera.yml -op -oe image_list.xml
where image_list.xml is the standard OpenCV XML/YAML
file consisting of the list of strings, e.g.:
<?xml version="1.0"?>
<opencv_storage>
<images>
"view000.png"
"view001.png"
<!-- view002.png -->
"view003.png"
"view010.png"
"one_extra_view.jpg"
</images>
</opencv_storage>
you can also use a video file or live camera input to calibrate the camera
*/
enum
{
DETECTION
=
0
,
CAPTURING
=
1
,
CALIBRATED
=
2
};
...
...
@@ -170,24 +177,18 @@ void saveCameraParams( const string& filename,
}
}
bool
readStringList
(
const
string
&
filename
,
vector
<
string
>&
l
)
static
bool
readStringList
(
const
string
&
filename
,
vector
<
string
>&
l
)
{
l
.
resize
(
0
);
F
ILE
*
f
=
fopen
(
filename
.
c_str
(),
"rt"
);
if
(
!
f
)
F
ileStorage
fs
(
filename
,
FileStorage
::
READ
);
if
(
!
fs
.
isOpened
()
)
return
false
;
for
(;;)
{
char
buf
[
1000
];
if
(
!
fgets
(
buf
,
sizeof
(
buf
)
-
2
,
f
))
break
;
char
*
ptr
=
strchr
(
buf
,
'\n'
);
if
(
ptr
)
*
ptr
=
'\0'
;
if
(
buf
[
0
]
!=
'\0'
&&
buf
[
0
]
!=
'#'
)
l
.
push_back
(
string
(
buf
));
}
fclose
(
f
);
FileNode
n
=
fs
.
getFirstTopLevelNode
();
if
(
n
.
type
()
!=
FileNode
::
SEQ
)
return
false
;
FileNodeIterator
it
=
n
.
begin
(),
it_end
=
n
.
end
();
for
(
;
it
!=
it_end
;
++
it
)
l
.
push_back
((
string
)
*
it
);
return
true
;
}
...
...
@@ -347,13 +348,10 @@ int main( int argc, char** argv )
if
(
inputFilename
)
{
capture
.
open
(
inputFilename
);
if
(
!
capture
.
isOpened
()
&&
!
readStringList
(
inputFilename
,
imageList
)
)
{
fprintf
(
stderr
,
"The input file could not be opened
\n
"
);
return
-
1
;
}
mode
=
CAPTURING
;
if
(
readStringList
(
inputFilename
,
imageList
)
)
mode
=
CAPTURING
;
else
capture
.
open
(
inputFilename
);
}
else
capture
.
open
(
cameraId
);
...
...
@@ -461,6 +459,8 @@ int main( int argc, char** argv )
mode
=
CALIBRATED
;
else
mode
=
DETECTION
;
if
(
!
capture
.
isOpened
()
)
break
;
}
}
return
0
;
...
...
samples/cpp/select3dobj.cpp
View file @
b2244f87
This diff is collapsed.
Click to expand it.
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