摘要
本文提供了一种获取IntelRealSense d435i相机内参的方法。
实现
#include <iostream>
#include <librealsense2/rs.hpp>
using namespace std;
using namespace rs2;
int main()
{
pipeline pipe;
frameset frames;
config cfg;
//cfg.enable_stream(RS2_STREAM_DEPTH, 640, 480, RS2_FORMAT_Z16, 30);
cfg.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_BGR8, 30);
pipe.start(cfg);
for (int i = 1; i < 20; i++)pipe.wait_for_frames();
frames = pipe.wait_for_frames();
auto color= frames.get_color_frame();
//auto depth = frames.get_depth_frame();
stream_profile color_profile = color.get_profile();
//stream_profile depth_profile = depth.get_profile();
auto rvsprofile = video_stream_profile(color_profile);
//auto dvsprofile = video_stream_profile(depth_profile);
rs2_intrinsics a = rvsprofile.get_intrinsics();
//rs2_intrinsics a = dvsprofile.get_intrinsics();
cout << "fx:\t" << a.fx << endl;
cout << "fy:\t" << a.fy << endl;
cout << "ppx:\t" << a.ppx << endl;
cout << "ppy:\t" << a.ppy << endl;
return 0;
}
提示1:代码时之前找到之后改的,但是现在找不到原链接了,这里只是记录一下,如果侵权请联系我删除。
提示2:不同分辨率和传感器可以通过cfg调整。