21 #ifndef VIDEOCAPTURE_HPP 
   22 #define VIDEOCAPTURE_HPP 
   32 #ifdef VIDEO_MOD_AVAILABLE 
   40 #ifdef SENSORS_MOD_AVAILABLE 
   53     uint64_t frame_id = 0;          
 
   54     uint64_t timestamp = 0;         
 
   55     uint8_t* data = 
nullptr;        
 
   66     ZED_OC_VERSION_ATTRIBUTE;
 
   85     bool initializeVideo( 
int devId=-1 );
 
   98     const Frame& getLastFrame(uint64_t timeout_msec=100);
 
  105     inline void getFrameSize( 
int& width, 
int& height ){width=mWidth;height=mHeight;}
 
  113     int setLEDstatus(
bool status);
 
  120     int getLEDstatus(
bool *status);
 
  127     int toggleLED(
bool *value);
 
  135     void setBrightness(
int brightness);
 
  146     void resetBrightness();
 
  152     void setSharpness(
int sharpness);
 
  163     void resetSharpness();
 
  169     void setContrast(
int contrast);
 
  180     void resetContrast();
 
  186     void setHue(
int hue);
 
  203     void setSaturation(
int saturation);
 
  214     void resetSaturation();
 
  220     void setWhiteBalance(
int wb);
 
  226     int getWhiteBalance();
 
  232     void setAutoWhiteBalance(
bool active);
 
  238     bool getAutoWhiteBalance();
 
  243     void resetAutoWhiteBalance();
 
  249     void setGamma(
int gamma);
 
  266     int setAECAGC(
bool active);
 
  288     bool setROIforAECAGC(
CAM_SENS_POS side, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
 
  306     bool getROIforAECAGC(
CAM_SENS_POS side,uint16_t& x, uint16_t& y, uint16_t& w, uint16_t& h);
 
  341     int getSerialNumber();
 
  346     void setColorBars(
int side, 
bool c);
 
  360 #ifdef SENSOR_LOG_AVAILABLE 
  367     bool enableAecAgcSensLogging(
bool enable, 
int frame_skip=10);
 
  374     void saveAllISPRegisters(std::string filename);
 
  381     void saveAllSensorsRegisters(std::string filename);
 
  385 #ifdef SENSORS_MOD_AVAILABLE 
  400         bool resetAGCAECregisters();
 
  403     void grabThreadFunc();  
 
  406     int ll_VendorControl(uint8_t *buf, 
int len, 
int readMode, 
bool safe = 
false, 
bool force=
false);
 
  407     int ll_get_gpio_value(
int gpio_number, uint8_t* value);
 
  408     int ll_set_gpio_value(
int gpio_number, uint8_t value);
 
  409     int ll_set_gpio_direction(
int gpio_number, 
int direction);
 
  410     int ll_read_system_register(uint64_t address, uint8_t* value);
 
  411     int ll_write_system_register(uint64_t address, uint8_t value);
 
  412     int ll_read_sensor_register(
int side, 
int sscb_id, uint64_t address, uint8_t *value);
 
  413     int ll_write_sensor_register(
int side, 
int sscb_id, uint64_t address, uint8_t value);
 
  415     int ll_SPI_FlashProgramRead(uint8_t *pBuf, 
int Adr, 
int len, 
bool force=
false);
 
  417     int ll_isp_aecagc_enable(
int side, 
bool enable);
 
  418     int ll_isp_is_aecagc(
int side);
 
  420     uint8_t ll_read_reg(uint64_t addr);
 
  422     int ll_isp_get_gain(uint8_t *val, uint8_t sensorID);
 
  423     int ll_isp_set_gain(
unsigned char ucGainH, 
unsigned char ucGainM, 
unsigned char ucGainL, 
int sensorID);
 
  424     int ll_isp_get_exposure(
unsigned char *val, 
unsigned char sensorID);
 
  425     int ll_isp_set_exposure(
unsigned char ucExpH, 
unsigned char ucExpM, 
unsigned char ucExpL, 
int sensorID);
 
  427     void ll_activate_sync(); 
 
  431     void setCameraControlSettings(
int ctrl_id, 
int ctrl_val);
 
  432     void resetCameraControlSettings(
int ctrl_id);
 
  433     int getCameraControlSettings(
int ctrl_id);
 
  435     int setGammaPreset(
int side, 
int value);
 
  437     int calcRawGainValue(
int gain); 
 
  438     int calcGainValue(
int rawGain); 
 
  442     bool openCamera( uint8_t devId );                           
 
  445     inline void stopCapture(){mStopCapture=
true;}               
 
  446     int input_set_framerate(
int fps);                           
 
  447     int xioctl(
int fd, uint64_t IOCTL_X, 
void *arg);            
 
  449     SL_DEVICE getCameraModel(std::string dev_name);     
 
  452     typedef enum _date_time
 
  459     static inline std::string getCurrentDateTime( DateTime type ){
 
  460         time_t now = time(0);
 
  463         tstruct = *localtime(&now);
 
  465             strftime(buf, 
sizeof(buf), 
"%Y-%m-%d %X", &tstruct);
 
  467             strftime(buf, 
sizeof(buf), 
"%Y-%m-%d", &tstruct);
 
  469             strftime(buf, 
sizeof(buf), 
"%X", &tstruct);
 
  470         return std::string(buf);
 
  473 #ifdef SENSOR_LOG_AVAILABLE 
  474     void saveLogDataLeft();
 
  475     void saveLogDataRight();
 
  480     bool mNewFrame=
false;               
 
  481     bool mInitialized=
false;            
 
  482     bool mStopCapture=
true;             
 
  483     bool mGrabRunning=
false;            
 
  488     std::string mDevName;               
 
  491     std::mutex mBufMutex;               
 
  492     std::mutex mComMutex;               
 
  502     uint8_t mBufCount = 2;              
 
  503     uint8_t mCurrentIndex = 0;          
 
  504     struct UVCBuffer *mBuffers = 
nullptr;  
 
  512     std::thread mGrabThread;            
 
  514     bool mFirstFrame=
true;              
 
  516 #ifdef SENSOR_LOG_AVAILABLE 
  518     bool mLogEnable=
false;
 
  519     std::string mLogFilenameLeft;
 
  520     std::string mLogFilenameRight;
 
  521     std::ofstream mLogFileLeft;
 
  522     std::ofstream mLogFileRight;
 
  523     int mLogFrameSkip=10;
 
  528 #ifdef SENSORS_MOD_AVAILABLE 
  529     bool mSyncEnabled=
false;            
 
  530     sensors::SensorCapture* mSensPtr;   
 
  532     bool mSensReadyToSync=
false;        
 
The SensorCapture class provides sensor grabbing functions for the Stereolabs ZED Mini and ZED2 camer...
 
The VideoCapture class provides image grabbing functions and settings control for all the Stereolabs ...
 
int getDeviceId()
Retrieve the OS device index.
 
void setReadyToSync()
Indicates that the SensorCapture object received the HW sync signal and a frame must be synchronized ...
 
void getFrameSize(int &width, int &height)
Get the size of the camera frame.
 
std::string getDeviceName()
Retrieve the OS device name.
 
struct sl_oc::video::VideoParams VideoParams
The camera configuration parameters.
 
CAM_SENS_POS
Position of the Camera CMOS sensors.
 
The Frame struct containing the acquired video frames.
 
The camera configuration parameters.
 
sl_oc::video::VideoParams params