1 #include <visp3/core/vpImage.h>
3 #include <visp3/gui/vpDisplayOpenCV.h>
4 #include <visp3/gui/vpDisplayX.h>
5 #include <visp3/io/vpImageStorageWorker.h>
6 #include <visp3/sensor/vp1394TwoGrabber.h>
8 void usage(
const char *argv[],
int error)
10 std::cout <<
"SYNOPSIS" << std::endl
11 <<
" " << argv[0] <<
" [--change-settings]"
12 <<
" [--seqname <sequence name>]"
13 <<
" [--record <mode>]"
15 <<
" [--help] [-h]" << std::endl
17 std::cout <<
"DESCRIPTION" << std::endl
18 <<
" --change-settings" << std::endl
19 <<
" Force camera settings to acquire 640x480 images in M0NO8 at 60 fps." << std::endl
21 <<
" --seqname <sequence name>" << std::endl
22 <<
" Name of the sequence of image to create (ie: /tmp/image%04d.jpg)." << std::endl
23 <<
" Default: empty." << std::endl
25 <<
" --record <mode>" << std::endl
26 <<
" Allowed values for mode are:" << std::endl
27 <<
" 0: record all the captures images (continuous mode)," << std::endl
28 <<
" 1: record only images selected by a user click (single shot mode)." << std::endl
29 <<
" Default mode: 0" << std::endl
31 <<
" --no-display" << std::endl
32 <<
" Disable displaying captured images." << std::endl
33 <<
" When used and sequence name specified, record mode is internaly set to 1 (continuous mode)."
36 <<
" --help, -h" << std::endl
37 <<
" Print this helper message." << std::endl
39 std::cout <<
"USAGE" << std::endl
40 <<
" Example to visualize images:" << std::endl
41 <<
" " << argv[0] << std::endl
43 <<
" Examples to record a sequence:" << std::endl
44 <<
" " << argv[0] <<
" --seqname I%04d.png" << std::endl
45 <<
" " << argv[0] <<
" --seqname folder/I%04d.png --record 0" << std::endl
47 <<
" Examples to record single shot images:\n"
48 <<
" " << argv[0] <<
" --seqname I%04d.png --record 1\n"
49 <<
" " << argv[0] <<
" --seqname folder/I%04d.png --record 1" << std::endl
53 std::cout <<
"Error" << std::endl
55 <<
"Unsupported parameter " << argv[error] << std::endl;
59 int main(
int argc,
const char *argv[])
61 #if defined(VISP_HAVE_DC1394) && (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
63 std::string opt_seqname;
64 int opt_record_mode = 0;
65 bool opt_change_settings =
false;
66 bool opt_display =
true;
68 for (
int i = 1; i < argc; i++) {
69 if (std::string(argv[i]) ==
"--change-settings") {
70 opt_change_settings =
true;
71 }
else if (std::string(argv[i]) ==
"--seqname") {
72 opt_seqname = std::string(argv[i + 1]);
74 }
else if (std::string(argv[i]) ==
"--record") {
75 opt_record_mode = std::atoi(argv[i + 1]);
77 }
else if (std::string(argv[i]) ==
"--no-display") {
79 }
else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
88 if ((!opt_display) && (!opt_seqname.empty())) {
92 std::cout <<
"Settings : " << (opt_change_settings ?
"modified" :
"current") << std::endl;
93 std::cout <<
"Recording : " << (opt_seqname.empty() ?
"disabled" :
"enabled") << std::endl;
94 std::cout <<
"Display : " << (opt_display ?
"enabled" :
"disabled") << std::endl;
96 std::string text_record_mode =
97 std::string(
"Record mode: ") + (opt_record_mode ? std::string(
"single") : std::string(
"continuous"));
99 if (!opt_seqname.empty()) {
100 std::cout << text_record_mode << std::endl;
101 std::cout <<
"Record name: " << opt_seqname << std::endl;
111 if (opt_change_settings) {
117 std::cout <<
"Warning: cannot modify camera settings" << std::endl;
125 std::cout <<
"Image size : " << I.
getWidth() <<
" " << I.
getHeight() << std::endl;
129 #if !(defined(VISP_HAVE_X11) || defined(VISP_HAVE_OPENCV))
130 std::cout <<
"No image viewer is available..." << std::endl;
137 #elif defined(VISP_HAVE_OPENCV)
154 quit = image_queue.record(I);
156 std::stringstream ss;
161 image_queue.cancel();
162 image_storage_thread.join();
168 std::cout <<
"Catch an exception: " << e << std::endl;
173 #ifndef VISP_HAVE_DC1394
174 std::cout <<
"Install libdc1394, configure and build ViSP again to use this example" << std::endl;
176 #if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
177 std::cout <<
"This turorial should be built with c++11 support" << std::endl;
Class for firewire ieee1394 video devices using libdc1394-2.x api.
@ vpVIDEO_MODE_640x480_MONO8
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Class that defines generic functionnalities for display.
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
error that can be emited by ViSP classes.
unsigned int getWidth() const
unsigned int getHeight() const
VISP_EXPORT double measureTimeMs()