|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
14 #define UNDISTORT_FPS 0
18 #ifndef UNDISTORT_MIN_X_NORMALIZED
19 #define UNDISTORT_MIN_X_NORMALIZED -2.0f
23 #ifndef UNDISTORT_MAX_X_NORMALIZED
24 #define UNDISTORT_MAX_X_NORMALIZED 2.0f
28 #ifndef UNDISTORT_CENTER_RATIO
29 #define UNDISTORT_CENTER_RATIO 1.00f
41 static
float K[9] = {0.0f, 0.0f, 0.0f,
50 float h_w_ratio = img->
h / (
float) img->
w;
73 index_dest = pixel_width*(y*img->
w+x);
74 dest[index_dest] = 128;
75 dest[index_dest+1] = 0;
85 for(
float y_n = min_y_normalized; y_n < max_y_normalized; y_n += normalized_step, y++) {
90 if(x_pd > 0.0
f && y_pd > 0.0
f) {
93 if(x_pd_ind < img->
w && y_pd_ind < img->
h) {
95 index_dest = pixel_width*(y*img->
w+x);
96 index_src = pixel_width*(y_pd_ind*img_distorted.
w+x_pd_ind);
97 dest[index_dest] = 128;
98 dest[index_dest+1] = source[index_src+1];
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
enum image_type type
The image type.
#define UNDISTORT_MIN_X_NORMALIZED
Minimal normalized coordinate that will be shown in the undistorted image.
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
void undistort_image_init(void)
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps, uint8_t id)
void image_free(struct image_t *img)
Free the image.
Functions for undistorting camera images.
#define UNDISTORT_CENTER_RATIO
Maximal normalized coordinate that will be shown in the undistorted image.
struct video_listener * listener
static struct image_t * undistort_image_func(struct image_t *img, uint8_t camera_id)
float Dhane_k
(un)distortion parameter for a fish-eye lens
void image_copy(struct image_t *input, struct image_t *output)
Copy an image from inut to output This will only work if the formats are the same.
bool normalized_coords_to_distorted_pixels(float x_n, float y_n, float *x_pd, float *y_pd, float k, const float *K)
Transform normalized coordinates to distorted pixel coordinates.
struct camera_intrinsics_t camera_intrinsics
float focal_y
focal length in the y-direction in pixels
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)
@ IMAGE_YUV422
UYVY format (uint16 per pixel)
float center_y
center image coordinate in the y-direction
#define UNDISTORT_FPS
Default FPS (zero means run at camera fps)
void * buf
Image buffer (depending on the image_type)
float center_x
center image coordinate in the x-direction
float focal_x
focal length in the x-direction in pixels
#define UNDISTORT_MAX_X_NORMALIZED
Maximal normalized coordinate that will be shown in the undistorted image.