|
#ifndef ZEDCAM_H |
|
#define ZEDCAM_H |
|
|
|
#include <sl/Camera.hpp> |
|
|
|
sl::Camera* create_camera() { |
|
sl::Camera* cam = new sl::Camera(); |
|
sl::InitParameters init_params; |
|
init_params.camera_resolution = sl::RESOLUTION::HD720; |
|
init_params.camera_fps = 60; |
|
sl::ERROR_CODE err = cam->open(init_params); |
|
if (err != sl::ERROR_CODE::SUCCESS) { |
|
std::cout << sl::toString(err) << std::endl; |
|
exit(-1); |
|
} |
|
return cam; |
|
} |
|
|
|
cv::Mat slMat2cvMat(sl::Mat& input) { |
|
|
|
|
|
return cv::Mat(input.getHeight(), input.getWidth(), CV_8UC4, input.getPtr<sl::uchar1>(sl::MEM::CPU), input.getStepBytes(sl::MEM::CPU)); |
|
} |
|
|
|
cv::cuda::GpuMat slMat2cvMatGPU(sl::Mat& input) { |
|
|
|
|
|
return cv::cuda::GpuMat(input.getHeight(), input.getWidth(), CV_8UC4, input.getPtr<sl::uchar1>(sl::MEM::GPU), input.getStepBytes(sl::MEM::GPU)); |
|
} |
|
|
|
#endif |