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 internally 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)
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;
72 else if (std::string(argv[i]) ==
"--seqname") {
73 opt_seqname = std::string(argv[i + 1]);
76 else if (std::string(argv[i]) ==
"--record") {
77 opt_record_mode = std::atoi(argv[i + 1]);
80 else if (std::string(argv[i]) ==
"--no-display") {
83 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
93 if ((!opt_display) && (!opt_seqname.empty())) {
97 std::cout <<
"Settings : " << (opt_change_settings ?
"modified" :
"current") << std::endl;
98 std::cout <<
"Recording : " << (opt_seqname.empty() ?
"disabled" :
"enabled") << std::endl;
99 std::cout <<
"Display : " << (opt_display ?
"enabled" :
"disabled") << std::endl;
101 std::string text_record_mode =
102 std::string(
"Record mode: ") + (opt_record_mode ? std::string(
"single") : std::string(
"continuous"));
104 if (!opt_seqname.empty()) {
105 std::cout << text_record_mode << std::endl;
106 std::cout <<
"Record name: " << opt_seqname << std::endl;
116 if (opt_change_settings) {
123 std::cout <<
"Warning: cannot modify camera settings" << std::endl;
131 std::cout <<
"Image size : " << I.
getWidth() <<
" " << I.
getHeight() << std::endl;
135 #if !(defined(VISP_HAVE_X11) || defined(VISP_HAVE_OPENCV))
136 std::cout <<
"No image viewer is available..." << std::endl;
143 #elif defined(HAVE_OPENCV_HIGHGUI)
160 quit = image_queue.record(I);
162 std::stringstream ss;
167 image_queue.cancel();
168 image_storage_thread.join();
175 std::cout <<
"Catch an exception: " << e << std::endl;
180 #ifndef VISP_HAVE_DC1394
181 std::cout <<
"Install libdc1394, configure and build ViSP again to use this example" << 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 functionalities 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 emitted by ViSP classes.
unsigned int getWidth() const
unsigned int getHeight() const
VISP_EXPORT double measureTimeMs()