53 float min_x = INFINITY, min_y = INFINITY, max_x = -INFINITY, max_y = -INFINITY;
54 for (
int i = 0; i <= steps; i++) {
55 const float tx = w * (float)i / (
float)steps;
56 const float ty = h * (float)i / (
float)steps;
57 const float border[4][2] = {{tx, 0.0f}, {tx, h}, {0.0f, ty}, {w, ty}};
59 for (
int j = 0; j < 4; j++) {
61 t_camera_models_undistort(calib, border[j][0], border[j][1], &x, &y);
62 if (!isfinite(x) || !isfinite(y)) {
65 min_x = fminf(min_x, x);
66 max_x = fmaxf(max_x, x);
67 min_y = fminf(min_y, y);
68 max_y = fmaxf(max_y, y);
81 if (min_x <= max_x && min_y <= max_y) {
82 left_pinhole = min_x * calib->fx + calib->cx;
83 right_pinhole = max_x * calib->fx + calib->cx;
84 top_pinhole = min_y * calib->fy + calib->cy;
85 bottom_pinhole = max_y * calib->fy + calib->cy;
static struct camera_model camera_model_init(int width_true, int height_true, const struct t_camera_model_params *calib)
Creates a camera model, computing a pinhole model (with the same focal lengths as the true calibratio...
Definition camera_model.h:46
@ T_DISTORTION_PINHOLE
A perfect pinhole camera with no distortion.
Definition t_tracking.h:67
Definition camera_model.h:21
float left_pinhole
The extents of the true frame's undistorted field of view, in pinhole pixel coordinates.
Definition camera_model.h:27
struct t_camera_model_params calib_pinhole
An identity calibration model.
Definition camera_model.h:38
int height_true
Distorted frame height.
Definition camera_model.h:25
struct t_camera_model_params calib_true
The true calibration of the camera.
Definition camera_model.h:36
int width_true
Distorted frame width.
Definition camera_model.h:23
float bottom_pinhole
See top_pinhole.
Definition camera_model.h:33
float top_pinhole
Valid pinhole y coordinates are [top_pinhole, bottom_pinhole].
Definition camera_model.h:31
float right_pinhole
See left_pinhole.
Definition camera_model.h:29
Floating point calibration data for a single calibrated camera.
Definition t_camera_models.h:62
Camera (un)projection C API for various camera models.