1 #include <visp3/core/vpImage.h> 3 #include <visp3/gui/vpDisplayGDI.h> 4 #include <visp3/gui/vpDisplayX.h> 5 #include <visp3/gui/vpDisplayOpenCV.h> 6 #include <visp3/sensor/vpFlyCaptureGrabber.h> 8 #include "record_helper.h" 10 int main(
int argc,
char **argv)
12 #ifdef VISP_HAVE_FLYCAPTURE 14 std::string opt_seqname;
15 int opt_record_mode = 0;
16 bool opt_change_settings =
false;
18 for (
int i = 0; i < argc; i++) {
19 if (std::string(argv[i]) ==
"--seqname")
20 opt_seqname = std::string(argv[i + 1]);
21 else if (std::string(argv[i]) ==
"--record")
22 opt_record_mode = std::atoi(argv[i + 1]);
23 else if (std::string(argv[i]) ==
"--change_settings")
24 opt_change_settings =
true;
25 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
26 std::cout <<
"\nUsage: " << argv[0]
27 <<
" [--seqname <sequence name (default: empty>] [--record <0: continuous | 1: single shot (default: 0)>]" 28 " [--change_settings] [--help] [-h]\n" 29 <<
"\nExample to visualize images:\n" 30 <<
" " << argv[0] <<
"\n" 31 <<
"\nExamples to record a sequence:\n" 32 <<
" " << argv[0] <<
" --seqname I%04d.png \n" 33 <<
" " << argv[0] <<
" --seqname folder/I%04d.png --record 0\n" 34 <<
"\nExamples to record single shot images:\n" 35 <<
" " << argv[0] <<
" --seqname I%04d.png --record 1\n" 36 <<
" " << argv[0] <<
" --seqname folder/I%04d.png --record 1\n" 42 std::cout <<
"Settings : " << (opt_change_settings ?
"modified" :
"current") << std::endl;
43 std::cout <<
"Recording : " << (opt_seqname.empty() ?
"disabled" :
"enabled") << std::endl;
45 std::string text_record_mode = std::string(
"Record mode: ") + (opt_record_mode ? std::string(
"single") :
std::string(
"continuous"));
47 if (! opt_seqname.empty()) {
48 std::cout << text_record_mode << std::endl;
49 std::cout <<
"Record name: " << opt_seqname << std::endl;
58 if (opt_change_settings) {
65 std::cout <<
"Warning: cannot modify camera settings" << std::endl;
73 std::cout <<
"Image size : " << I.
getWidth() <<
" " << I.
getHeight() << std::endl;
75 #if defined(VISP_HAVE_X11) 77 #elif defined(VISP_HAVE_GDI) 79 #elif defined(VISP_HAVE_OPENCV) 82 std::cout <<
"No image viewer is available..." << std::endl;
95 quit = record_helper(opt_seqname, opt_record_mode, I);
108 std::cout <<
"Install Flycapture SDK, configure and build ViSP again to use this example" << std::endl;
unsigned int getWidth() const
Display for windows using GDI (available on any windows 32 platform).
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
float setShutter(bool auto_shutter, float shutter_ms=10)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
void acquire(vpImage< unsigned char > &I)
error that can be emited by ViSP classes.
static void flush(const vpImage< unsigned char > &I)
VISP_EXPORT double measureTimeMs()
void open(vpImage< unsigned char > &I)
float setGain(bool gain_auto, float gain_value=0)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
unsigned int getHeight() const
const std::string & getStringMessage(void) const
Send a reference (constant) related the error message (can be empty).
void setVideoModeAndFrameRate(FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate)