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
7df9aef9
Commit
7df9aef9
authored
Nov 19, 2010
by
Gary Bradski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added description, fixed missing >
parent
96ad3b57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
select3dobj.cpp
samples/cpp/select3dobj.cpp
+42
-1
No files found.
samples/cpp/select3dobj.cpp
View file @
7df9aef9
/*
*
This program's purpose is to collect data sets of an object and its segmentation mask.
It shows how to use a calibrated camera together with a calibration pattern to
compute the homography of the plane the calibration pattern is on. It also shows grabCut
segmentation etc.
select3dobj -w <board_width> -h <board_height> [-s <square_size>]
-i <camera_intrinsics_filename> -o <output_prefix> [video_filename/cameraId]
-w <board_width> Number of chessboard corners wide
-h <board_height> Number of chessboard corners width
[-s <square_size>] Optional measure of chessboard squares in meters
-i <camera_intrinsics_filename> Camera matrix .yml file from calibration.cpp
-o <output_prefix> Prefix the output segmentation images with this
[video_filename/cameraId] If present, read from that video file or that ID
Using a camera's intrinsics (from calibrating a camera -- see calibration.cpp) and an
image of the object sitting on a planar surface with a calibration pattern of
(board_width x board_height) on the surface, we draw a 3D box aroung the object. From
then on, we can move a camera and as long as it sees the chessboard calibration pattern,
it will store a mask of where the object is. We get succesive images using <output_prefix>
of the segmentation mask containing the object. This makes creating training sets easy.
It is best of the chessboard is odd x even in dimensions to avoid amiguous poses.
The actions one can use while the program is running are:
Select object as 3D box with the mouse.
First draw one line on the plane to outline the projection of that object on the plane
Then extend that line into a box to encompass the projection of that object onto the plane
The use the mouse again to extend the box upwards from the plane to encase the object.
Then use the following commands
ESC - Reset the selection
SPACE - Skip the frame; move to the next frame (not in video mode)
ENTER - Confirm the selection. Grab next object in video mode.
q - Exit the program
*
*/
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
...
...
@@ -326,7 +367,7 @@ static bool readStringList( const string& filename, vector<string>& l )
int
main
(
int
argc
,
char
**
argv
)
{
const
char
*
help
=
"Usage: select3dobj -w <board_width -h <board_height> [-s <square_size>]
\n
"
const
char
*
help
=
"Usage: select3dobj -w <board_width
>
-h <board_height> [-s <square_size>]
\n
"
"
\t
-i <intrinsics_filename> -o <output_prefix> [video_filename/cameraId]
\n
"
;
const
char
*
screen_help
=
"Actions:
\n
"
...
...
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