下载SDK
wget https://stereolabs.sfo2.cdn.digitaloceanspaces.com/zedsdk/3.6/ZED_SDK_Ubuntu18_cuda11.5_v3.6.5.run
安装
./ZED_SDK_Ubuntu18_cuda11.5_v3.6.5.run skip_python
测试
cd /usr/local/zed/tools
ls
ZED_Calibration ZED_Depth_Viewer ZED_Diagnostic ZED_Explorer ZEDfu ZED_Sensor_Viewer ZED_SVO_Editor
./ZED_Depth_Viewer
标定文件下载
http://calib.stereolabs.com/?SN=4444
http://calib.stereolabs.com/?SN=自己相机的SN号(在SDK中ZED Explorer中查看)
卸载
cd /usr/local
sudo rm -rf zed
zed-ros
下载和SDK版本一样的ros-zed
https://github.com/stereolabs/zed-ros-wrapper
$ cd ~/catkin_ws/src
## git clone https://github.com/stereolabs/zed-ros-interfaces.git
$ cd ../
$ rosdep install --from-paths src --ignore-src -r -y
$ catkin_make -DCMAKE_BUILD_TYPE=Release
$ source ./devel/setup.bash
zed2i.launch zed2.launch zed_camera_nodelet.launch zed.launch zedm.launch zed_no_tf.launch
roslaunch zed_wrapper zed.launch
demo
#include <sl/Camera.hpp>
int main(int argc, char **argv) {
sl::Camera zed;
sl::InitParameters init_params;
init_params.camera_resolution = sl::RESOLUTION::HD720;
init_params.depth_mode = sl::DEPTH_MODE::PERFORMANCE;
// 开始相机
if (zed.open(init_params) != sl::ERROR_CODE::SUCCESS) {
std::cerr << "Error opening ZED camera." << std::endl;
return EXIT_FAILURE;
}
sl::Mat image, depth;
while (true) {
if (zed.grab() == sl::ERROR_CODE::SUCCESS) {
zed.retrieveImage(image, sl::VIEW::LEFT);
zed.retrieveMeasure(depth, sl::MEASURE::DEPTH);
// 显示图像和深度
cv::imshow("ZED Image", image.getCvMat());
cv::imshow("ZED Depth", depth.getCvMat());
if (cv::waitKey(1) == 'q') break;
}
}
zed.close();
return EXIT_SUCCESS;
}