Example of how to use the VideoCapture class to get and rectify raw video frames downloading calibration parameters from Stereolabs servers.
#include <iostream>
#include <sstream>
#include <string>
#include <opencv2/opencv.hpp>
int main(
int argc,
char *argv[])
{
(void)argc;
(void)argv;
{
std::cerr << "Cannot open camera video capture" << std::endl;
std::cerr << "See verbosity level for more details." << std::endl;
return EXIT_FAILURE;
}
std::cout << "Connected to camera sn: " << sn << std::endl;
std::string calibration_file;
unsigned int serial_number = sn;
{
std::cerr << "Could not load calibration file from Stereolabs servers" << std::endl;
return EXIT_FAILURE;
}
std::cout << "Calibration file found. Loading..." << std::endl;
int w,h;
cv::Mat map_left_x, map_left_y;
cv::Mat map_right_x, map_right_y;
cv::Mat cameraMatrix_left, cameraMatrix_right;
cameraMatrix_left, cameraMatrix_right);
std::cout << " Camera Matrix L: \n" << cameraMatrix_left << std::endl << std::endl;
std::cout << " Camera Matrix R: \n" << cameraMatrix_right << std::endl << std::endl;
uint64_t last_ts=0;
while (1)
{
{
}
int key = cv::waitKey( 5 );
if(key=='q' || key=='Q')
break;
}
return EXIT_SUCCESS;
}
The VideoCapture class provides image grabbing functions and settings control for all the Stereolabs ...
const Frame & getLastFrame(uint64_t timeout_msec=100)
Get the last received camera image.
void getFrameSize(int &width, int &height)
Get the size of the camera frame.
bool initializeVideo(int devId=-1)
Open a ZED camera using the specified ID or searching for the first available.
int getSerialNumber()
Retrieve the serial number of the connected camera.
@ FPS_15
15 Frames per second. Available for all the resolutions.
The Frame struct containing the acquired video frames.
uint64_t timestamp
Timestamp in nanoseconds.
uint16_t height
Frame height.
uint16_t width
Frame width.
uint8_t * data
Frame data in YUV 4:2:2 format.
The camera configuration parameters.
RESOLUTION res
Camera resolution.
FPS fps
Frames per second.
int main(int argc, char *argv[])
sl_oc::video::VideoParams params