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.0f && y_pd > 0.0f) {
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];
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps, uint8_t id)
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.
void image_free(struct image_t *img)
Free the image.
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
Image helper functions like resizing, color filter, converters...
void * buf
Image buffer (depending on the image_type)
enum image_type type
The image type.
@ IMAGE_YUV422
UYVY format (uint16 per pixel)
struct video_listener * listener
static struct image_t * undistort_image_func(struct image_t *img, uint8_t camera_id)
void undistort_image_init(void)
#define UNDISTORT_CENTER_RATIO
Maximal normalized coordinate that will be shown in the undistorted image.
struct camera_intrinsics_t camera_intrinsics
#define UNDISTORT_MAX_X_NORMALIZED
Maximal normalized coordinate that will be shown in the undistorted image.
#define UNDISTORT_MIN_X_NORMALIZED
Minimal normalized coordinate that will be shown in the undistorted image.
#define UNDISTORT_FPS
Default FPS (zero means run at camera fps)
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.
Functions for undistorting camera images.
float focal_y
focal length in the y-direction in pixels
float center_x
center image coordinate in the x-direction
float focal_x
focal length in the x-direction in pixels
float Dhane_k
(un)distortion parameter for a fish-eye lens
float center_y
center image coordinate in the y-direction
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.