#include <visp3/core/vpImage.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/sensor/vpPylonFactory.h>
#include <visp3/io/vpImageStorageWorker.h>
int main(int argc, const char *argv[])
{
#if defined(VISP_HAVE_PYLON) && (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
try {
unsigned int opt_camera = 0;
std::string opt_device("GigE");
std::string opt_seqname;
int opt_record_mode = 0;
bool opt_change_settings = false;
for (int i = 0; i < argc; i++) {
if (std::string(argv[i]) == "--camera")
opt_camera = (unsigned int)atoi(argv[i + 1]);
else if (std::string(argv[i]) == "--device")
opt_device = std::string(argv[i + 1]);
else if (std::string(argv[i]) == "--seqname")
opt_seqname = std::string(argv[i + 1]);
else if (std::string(argv[i]) == "--record")
opt_record_mode = std::atoi(argv[i + 1]);
else if (std::string(argv[i]) == "--change_settings")
opt_change_settings = true;
else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") {
std::cout << "\nUsage: " << argv[0]
<< " [--camera <0...9> (default: 0)] [--device <\"GigE\"|\"USB\" (default: GigE)>]"
<< " [--seqname <sequence name (default: empty)>] [--record <0: continuous | 1: single shot (default: 0)>]"
<< " [--change_settings] [--help] [-h]\n"
<< "\nExample to visualize images:\n"
<< " " << argv[0] << " \n"
<< " " << argv[0] << " --device GigE --camera 0\n"
<< "\nExamples to record a sequence:\n"
<< " " << argv[0] << " --seqname I%04d.png \n"
<< " " << argv[0] << " --seqname folder/I%04d.png --record 0\n"
<< "\nExamples to record single shot images:\n"
<< " " << argv[0] << " --seqname I%04d.png --record 1\n"
<< " " << argv[0] << " --seqname folder/I%04d.png --record 1\n"
<< std::endl;
return 0;
}
}
std::cout << "Settings : " << (opt_change_settings ? "modified" : "current") << std::endl;
std::cout << "Recording : " << (opt_seqname.empty() ? "disabled" : "enabled") << std::endl;
std::string text_record_mode = std::string("Record mode: ") + (opt_record_mode ? std::string("single") : std::string("continuous"));
if (! opt_seqname.empty()) {
std::cout << text_record_mode << std::endl;
std::cout << "Record name: " << opt_seqname << std::endl;
}
if (opt_device == "GigE" || opt_device == "gige") {
std::cout << "Opening Basler GigE camera: " << opt_camera << std::endl;
} else if (opt_device == "USB" || opt_device == "usb") {
std::cout << "Opening Basler USB camera: " << opt_camera << std::endl;
} else {
std::cout << "Error: only Basler GigE or USB cameras are supported." << std::endl;
return EXIT_SUCCESS;
}
#ifdef VISP_HAVE_X11
#elif defined(VISP_HAVE_GDI)
#elif defined(VISP_HAVE_OPENCV)
#else
std::cout << "No image viewer is available..." << std::endl;
#endif
bool quit = false;
while (! quit) {
std::stringstream ss;
}
image_storage_thread.join();
std::cout << "Catch an exception: " << e << std::endl;
}
#else
(void) argc;
(void) argv;
#ifndef VISP_HAVE_PYLON
std::cout << "Install Basler Pylon SDK, configure and build ViSP again to use this example" << std::endl;
#endif
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
std::cout << "This turorial should be built with c++11 support" << std::endl;
#endif
#endif
}
Display for windows using GDI (available on any windows 32 platform).
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...
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.
bool record(const vpImage< Type > &I, std::string *data=NULL, bool trigger_recording=false, bool disable_left_click=false)
unsigned int getWidth() const
unsigned int getHeight() const
Factory singleton class to create vpPylonGrabber subclass instances.
@ BASLER_GIGE
Basler GigE camera.
@ BASLER_USB
Basler USB camera.
static vpPylonFactory & instance()
Get the vpPylonFactory singleton.
vpPylonGrabber * createPylonGrabber(DeviceClass dev_class)
Create an object of vpPylonGrabber.
virtual void acquire(vpImage< unsigned char > &I)=0
virtual void open(vpImage< unsigned char > &I)=0
virtual void setCameraIndex(unsigned int index)=0
VISP_EXPORT double measureTimeMs()