40 #include <visp3/core/vpConfig.h>
41 #include <visp3/core/vpDebug.h>
46 #if defined(VISP_HAVE_PYLON)
48 #include <visp3/core/vpIoTools.h>
49 #include <visp3/io/vpImageIo.h>
50 #include <visp3/sensor/vpPylonFactory.h>
54 #ifdef ENABLE_VISP_NAMESPACE
58 std::cout <<
"Basler camera test with Pylon in progress..." << std::endl;
63 std::string outputpath =
"/tmp/" + username;
75 unsigned int ncameras;
77 for (
unsigned int i = 0; i < ncameras; i++) {
80 std::cout <<
"Detected camera with serial: " << guid << std::endl;
86 std::cout <<
"Use camera with serial: " << guid << std::endl;
94 std::cout <<
"Frame rate: " << g->
getFrameRate() << std::endl;
95 std::cout <<
"Gain: " << g->
getGain() << std::endl;
96 std::cout <<
"Gamma: " << g->
getGamma() << std::endl;
97 std::cout <<
"Exposure time (ms): " << g->
getExposure() << std::endl;
99 std::cout <<
"Black level: " << blackLevel << std::endl;
101 for (
int i = 0; i < 10; i++)
104 std::cout <<
"Current image size: " << g->
getWidth() <<
"x" << g->
getHeight() << std::endl;
106 std::string filename = outputpath +
"/imagetest1.pgm";
107 std::cout <<
"Write image: " << filename << std::endl;
110 std::cout <<
"New connection..." << std::endl;
114 std::cout <<
"New connection..." << std::endl;
117 filename = outputpath +
"/imagetest2.pgm";
118 std::cout <<
"Write image: " << filename << std::endl;
122 vpCERROR << e.
what() << std::endl;
124 catch (
const std::exception &e) {
125 vpCERROR << e.what() << std::endl;
128 vpCERROR <<
"Failure: exit" << std::endl;
134 #ifdef ENABLE_VISP_NAMESPACE
137 vpTRACE(
"Basler Pylon grabber capabilities are not available...\n"
138 "You should install pylon SDK to use this binary.");
error that can be emitted by ViSP classes.
const char * what() const
unsigned int getWidth() const
Return the number of columns in the image.
unsigned int getHeight() const
Return the number of rows in the image.
static void write(const vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
Factory singleton class to create vpPylonGrabber subclass instances.
static vpPylonFactory & instance()
Get the vpPylonFactory singleton.
@ BASLER_GIGE
Basler GigE camera.
vpPylonGrabber * createPylonGrabber(DeviceClass dev_class)
Create an object of vpPylonGrabber.
virtual void close()=0
Stop active camera capturing images and disconnect the active camera.
virtual float getFrameRate()=0
virtual unsigned int getNumCameras()=0
Get the number of cameras of specific subclasses. GigE, USB, etc.
virtual void setCameraSerial(const std::string &serial)=0
virtual float getBlackLevel()=0
virtual float getGain()=0
virtual void acquire(vpImage< unsigned char > &I)=0
virtual float getExposure()=0
virtual void open(vpImage< unsigned char > &I)=0
virtual std::string getCameraSerial(unsigned int index)=0
virtual std::ostream & getCameraInfo(std::ostream &os)=0
virtual void setCameraIndex(unsigned int index)=0
virtual float getGamma()=0