106 const float fx = 1500.0;
107 const float fy = 1000.0;
108 const float cx = 960.0;
109 const float cy = 600.0;
110 const float tx = -0.27;
113 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
114 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
115 {{{fx, 0.0, cx, 0.0}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
116 CameraCalibration::DistortionType::NONE,
120 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
121 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
122 {{{fx, 0.0, cx, fx * tx}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
123 CameraCalibration::DistortionType::NONE,
129 const double x = 0.5;
130 const double y = 1.5;
131 const double z = 5.5;
134 const double left_u = ((fx * x) + (cx * z)) / z;
135 const double left_v = ((fy * y) + (cy * z)) / z;
138 const double right_u = ((fx * x) + (cx * z) + (tx * fx)) / z;
152 const float fx = 1000.0;
153 const float fy = 1000.0;
154 const float cx = 960.0;
155 const float cy = 600.0;
156 const float tx = -0.27;
157 const float aux_tx = -0.033;
160 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
161 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
162 {{{fx, 0.0, cx, 0.0}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
163 CameraCalibration::DistortionType::NONE,
167 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
168 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
169 {{{fx, 0.0, cx, fx * tx}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
170 CameraCalibration::DistortionType::NONE,
174 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
175 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
176 {{{fx, 0.0, cx, fx *
aux_tx}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
177 CameraCalibration::DistortionType::NONE,
184 ImageFrame frame{0, {},
StereoCalibration{
left_calibration,
right_calibration,
aux_calibration}, {}, {}, {}, {}, {}, {}};
190 Image::PixelFormat::FLOAT32,
191 DataSource::LEFT_DISPARITY_RAW,
196 Image::PixelFormat::FLOAT32,
197 DataSource::LEFT_DISPARITY_RAW,
202 Image::PixelFormat::MONO16,
203 DataSource::LEFT_DISPARITY_RAW,
237 const float fx = 1000.0;
238 const float fy = 1000.0;
239 const float cx = 960.0;
240 const float cy = 600.0;
241 const float tx = -0.27;
242 const float aux_tx = -0.033;
245 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
246 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
247 {{{fx, 0.0, cx, 0.0}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
248 CameraCalibration::DistortionType::NONE,
252 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
253 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
254 {{{fx, 0.0, cx, fx * tx}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
255 CameraCalibration::DistortionType::NONE,
259 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
260 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
261 {{{fx, 0.0, cx, fx *
aux_tx}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
262 CameraCalibration::DistortionType::NONE,
269 ImageFrame frame{0, {},
StereoCalibration{
left_calibration,
right_calibration,
aux_calibration}, {}, {}, {}, {}, {}, {}};
285 const float fx = 1000.0;
286 const float fy = 1000.0;
287 const float cx = 960.0;
288 const float cy = 600.0;
291 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
292 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
293 {{{fx, 0.0, cx, 0.0}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
294 CameraCalibration::DistortionType::NONE,
297 const size_t width = 1920;
298 const size_t height = 1200;
302 std::vector<uint8_t>
y_data(width * height,
val);
305 std::vector<uint8_t>
cbcr_data(width * height/2, 128);
307 const Image y{std::make_shared<const std::vector<uint8_t>>(std::move(
y_data)),
310 Image::PixelFormat::MONO8,
311 static_cast<int>(width),
312 static_cast<int>(height),
315 DataSource::AUX_LUMA_RAW,
320 width / 2 * height / 2,
321 Image::PixelFormat::MONO16,
322 static_cast<int>(width/2),
323 static_cast<int>(height/2),
326 DataSource::AUX_CHROMA_RAW,
335 for (
size_t h = 0 ;
h < height ; ++
h)
337 for (
size_t w = 0 ;
w < width ; ++
w)
350 const float fx = 1000.0;
351 const float fy = 1000.0;
352 const float cx = 960.0;
353 const float cy = 600.0;
354 const float tx = -0.27;
357 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
358 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
359 {{{fx, 0.0, cx, 0.0}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
360 CameraCalibration::DistortionType::NONE,
364 {{{fx, 0.0, cx}, {0.0, fy, cy}, {0.0, 0.0, 1.0}}},
365 {{{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}},
366 {{{fx, 0.0, cx, fx * tx}, {0.0, fy, cy, 0.0}, {0.0, 0.0, 1.0, 0.0}}},
367 CameraCalibration::DistortionType::NONE,
374 ImageFrame frame{0, {},
StereoCalibration{
left_calibration,
right_calibration, std::nullopt}, {}, {}, {}, {}, {}, {}};
Image create_example_disparity_image(const CameraCalibration &left_calibration, const CameraCalibration &right_calibration, double obstacle_radius_m, double obstacle_distance_m, size_t width, size_t height)
MULTISENSE_API std::optional< Point< void > > get_aux_3d_point(const ImageFrame &frame, const Pixel &rectified_aux_pixel, size_t max_pixel_search_window, double pixel_epsilon, const DataSource &disparity_source=DataSource::LEFT_DISPARITY_RAW)
for a given pixel in the aux image, return the corresponding 3D point associated with the aux pixel
MULTISENSE_API std::optional< PointCloud< Color > > create_color_pointcloud(const Image &disparity, const std::optional< Image > &color, double max_range, const StereoCalibration &calibration)
Create a point cloud from a image frame and a color source.
MULTISENSE_API std::optional< Image > create_bgr_from_ycbcr420(const Image &luma, const Image &chroma, const DataSource &output_source)
Convert a YCbCr420 luma + chroma image into a BGR color image.
MULTISENSE_API std::optional< Image > create_depth_image(const ImageFrame &frame, const Image::PixelFormat &depth_format, const DataSource &disparity_source=DataSource::LEFT_DISPARITY_RAW, bool compute_in_aux_frame=false, float invalid_value=0)
Create a depth image from a image frame.