Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
pano_unwrap.c File Reference
#include "modules/pano_unwrap/pano_unwrap.h"
#include "state.h"
#include "modules/computer_vision/cv.h"
#include <stdio.h>
+ Include dependency graph for pano_unwrap.c:

Go to the source code of this file.

Data Structures

struct  LUT_t
 

Macros

#define PANO_UNWRAP_CAMERA   bottom_camera
 
#define PANO_UNWRAP_CENTER_X   0.50
 
#define PANO_UNWRAP_CENTER_Y   0.50
 
#define PANO_UNWRAP_RADIUS_BOTTOM   0.20
 
#define PANO_UNWRAP_RADIUS_TOP   0.30
 
#define PANO_UNWRAP_FORWARD_DIRECTION   270.0
 
#define PANO_UNWRAP_FLIP_HORIZONTAL   FALSE
 
#define PANO_UNWRAP_VERTICAL_RESOLUTION   0.18
 
#define PANO_UNWRAP_DEROTATE_ATTITUDE   FALSE
 
#define PANO_UNWRAP_WIDTH   640
 
#define PANO_UNWRAP_HEIGHT   0
 
#define PANO_UNWRAP_OVERWRITE_VIDEO_THREAD   TRUE
 
#define PANO_UNWRAP_FPS   0
 
#define PIXEL_U(img, x, y)   ( ((uint8_t*)((img)->buf))[4*(int)((x)/2) + 2*(y)*(img)->w] )
 
#define PIXEL_V(img, x, y)   ( ((uint8_t*)((img)->buf))[4*(int)((x)/2) + 2*(y)*(img)->w + 2] )
 
#define PIXEL_Y(img, x, y)   ( ((uint8_t*)((img)->buf))[2*(x) + 1 + 2*(y)*(img)->w] )
 
#define RED_Y   76
 
#define RED_U   84
 
#define RED_V   255
 
#define GREEN_Y   149
 
#define GREEN_U   43
 
#define GREEN_V   21
 
#define BLUE_Y   29
 
#define BLUE_U   255
 
#define BLUE_V   107
 

Functions

static void set_output_image_size (void)
 
static void update_LUT (const struct image_t *img)
 
static void unwrap_LUT (struct image_t *img_raw, struct image_t *img)
 
static struct image_tcamera_cb (struct image_t *img, uint8_t camera_id)
 
void pano_unwrap_init ()
 

Variables

struct pano_unwrap_t pano_unwrap
 
struct image_t pano_unwrapped_image
 Unwrapped panoramic image. More...
 
static struct LUT_t LUT
 

Detailed Description

Author
Tom van Dijk Unwrap images taken through a panoramic lens.

Definition in file pano_unwrap.c.


Data Structure Documentation

◆ LUT_t

struct LUT_t

Definition at line 115 of file pano_unwrap.c.

+ Collaboration diagram for LUT_t:
Data Fields
struct FloatVect2 * dphi
struct FloatVect2 * dtheta
struct pano_unwrap_t settings
uint16_t * x
uint16_t * y

Macro Definition Documentation

◆ BLUE_U

#define BLUE_U   255

Definition at line 112 of file pano_unwrap.c.

◆ BLUE_V

#define BLUE_V   107

Definition at line 113 of file pano_unwrap.c.

◆ BLUE_Y

#define BLUE_Y   29

Definition at line 111 of file pano_unwrap.c.

◆ GREEN_U

#define GREEN_U   43

Definition at line 109 of file pano_unwrap.c.

◆ GREEN_V

#define GREEN_V   21

Definition at line 110 of file pano_unwrap.c.

◆ GREEN_Y

#define GREEN_Y   149

Definition at line 108 of file pano_unwrap.c.

◆ PANO_UNWRAP_CAMERA

#define PANO_UNWRAP_CAMERA   bottom_camera

Definition at line 34 of file pano_unwrap.c.

◆ PANO_UNWRAP_CENTER_X

#define PANO_UNWRAP_CENTER_X   0.50

Definition at line 38 of file pano_unwrap.c.

◆ PANO_UNWRAP_CENTER_Y

#define PANO_UNWRAP_CENTER_Y   0.50

Definition at line 41 of file pano_unwrap.c.

◆ PANO_UNWRAP_DEROTATE_ATTITUDE

#define PANO_UNWRAP_DEROTATE_ATTITUDE   FALSE

Definition at line 60 of file pano_unwrap.c.

◆ PANO_UNWRAP_FLIP_HORIZONTAL

#define PANO_UNWRAP_FLIP_HORIZONTAL   FALSE

Definition at line 53 of file pano_unwrap.c.

◆ PANO_UNWRAP_FORWARD_DIRECTION

#define PANO_UNWRAP_FORWARD_DIRECTION   270.0

Definition at line 50 of file pano_unwrap.c.

◆ PANO_UNWRAP_FPS

#define PANO_UNWRAP_FPS   0

Definition at line 75 of file pano_unwrap.c.

◆ PANO_UNWRAP_HEIGHT

#define PANO_UNWRAP_HEIGHT   0

Definition at line 67 of file pano_unwrap.c.

◆ PANO_UNWRAP_OVERWRITE_VIDEO_THREAD

#define PANO_UNWRAP_OVERWRITE_VIDEO_THREAD   TRUE

Definition at line 71 of file pano_unwrap.c.

◆ PANO_UNWRAP_RADIUS_BOTTOM

#define PANO_UNWRAP_RADIUS_BOTTOM   0.20

Definition at line 44 of file pano_unwrap.c.

◆ PANO_UNWRAP_RADIUS_TOP

#define PANO_UNWRAP_RADIUS_TOP   0.30

Definition at line 47 of file pano_unwrap.c.

◆ PANO_UNWRAP_VERTICAL_RESOLUTION

#define PANO_UNWRAP_VERTICAL_RESOLUTION   0.18

Definition at line 57 of file pano_unwrap.c.

◆ PANO_UNWRAP_WIDTH

#define PANO_UNWRAP_WIDTH   640

Definition at line 64 of file pano_unwrap.c.

◆ PIXEL_U

#define PIXEL_U (   img,
  x,
 
)    ( ((uint8_t*)((img)->buf))[4*(int)((x)/2) + 2*(y)*(img)->w] )

Definition at line 101 of file pano_unwrap.c.

◆ PIXEL_V

#define PIXEL_V (   img,
  x,
 
)    ( ((uint8_t*)((img)->buf))[4*(int)((x)/2) + 2*(y)*(img)->w + 2] )

Definition at line 102 of file pano_unwrap.c.

◆ PIXEL_Y

#define PIXEL_Y (   img,
  x,
 
)    ( ((uint8_t*)((img)->buf))[2*(x) + 1 + 2*(y)*(img)->w] )

Definition at line 103 of file pano_unwrap.c.

◆ RED_U

#define RED_U   84

Definition at line 106 of file pano_unwrap.c.

◆ RED_V

#define RED_V   255

Definition at line 107 of file pano_unwrap.c.

◆ RED_Y

#define RED_Y   76

Definition at line 105 of file pano_unwrap.c.

Function Documentation

◆ camera_cb()

static struct image_t* camera_cb ( struct image_t img,
uint8_t  camera_id 
)
static

Definition at line 303 of file pano_unwrap.c.

References pano_unwrap_t::overwrite_video_thread, pano_unwrap, pano_unwrapped_image, image_t::pprz_ts, set_output_image_size(), image_t::ts, unwrap_LUT(), and update_LUT().

Referenced by pano_unwrap_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pano_unwrap_init()

void pano_unwrap_init ( )

Definition at line 313 of file pano_unwrap.c.

References camera_cb(), cv_add_to_device(), image_create(), IMAGE_YUV422, PANO_UNWRAP_CAMERA, PANO_UNWRAP_FPS, pano_unwrapped_image, and set_output_image_size().

+ Here is the call graph for this function:

◆ set_output_image_size()

static void set_output_image_size ( void  )
static

Definition at line 132 of file pano_unwrap.c.

References image_t::h, pano_unwrap_t::height, image_create(), image_free(), IMAGE_YUV422, pano_unwrap, pano_unwrapped_image, pano_unwrap_t::radius_bottom, pano_unwrap_t::radius_top, pano_unwrap_t::vertical_resolution, image_t::w, and pano_unwrap_t::width.

Referenced by camera_cb(), and pano_unwrap_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unwrap_LUT()

static void unwrap_LUT ( struct image_t img_raw,
struct image_t img 
)
static

◆ update_LUT()

static void update_LUT ( const struct image_t img)
static

Variable Documentation

◆ LUT

struct LUT_t LUT
static

Definition at line 130 of file pano_unwrap.c.

Referenced by unwrap_LUT(), and update_LUT().

◆ pano_unwrap

struct pano_unwrap_t pano_unwrap
Initial value:
= {
.center = {
},
.radius_bottom = PANO_UNWRAP_RADIUS_BOTTOM,
.radius_top = PANO_UNWRAP_RADIUS_TOP,
.forward_direction = PANO_UNWRAP_FORWARD_DIRECTION,
.flip_horizontal = PANO_UNWRAP_FLIP_HORIZONTAL,
.vertical_resolution = PANO_UNWRAP_VERTICAL_RESOLUTION,
.derotate_attitude = PANO_UNWRAP_DEROTATE_ATTITUDE,
.height = PANO_UNWRAP_HEIGHT,
.overwrite_video_thread = PANO_UNWRAP_OVERWRITE_VIDEO_THREAD,
.show_calibration = FALSE,
}

Definition at line 78 of file pano_unwrap.c.

Referenced by camera_cb(), set_output_image_size(), unwrap_LUT(), and update_LUT().

◆ pano_unwrapped_image

struct image_t pano_unwrapped_image

Unwrapped panoramic image.

Definition at line 99 of file pano_unwrap.c.

Referenced by camera_cb(), pano_unwrap_init(), set_output_image_size(), and update_LUT().

PANO_UNWRAP_WIDTH
#define PANO_UNWRAP_WIDTH
Definition: pano_unwrap.c:64
PANO_UNWRAP_RADIUS_BOTTOM
#define PANO_UNWRAP_RADIUS_BOTTOM
Definition: pano_unwrap.c:44
PANO_UNWRAP_FLIP_HORIZONTAL
#define PANO_UNWRAP_FLIP_HORIZONTAL
Definition: pano_unwrap.c:53
PANO_UNWRAP_FORWARD_DIRECTION
#define PANO_UNWRAP_FORWARD_DIRECTION
Definition: pano_unwrap.c:50
PANO_UNWRAP_DEROTATE_ATTITUDE
#define PANO_UNWRAP_DEROTATE_ATTITUDE
Definition: pano_unwrap.c:60
PANO_UNWRAP_RADIUS_TOP
#define PANO_UNWRAP_RADIUS_TOP
Definition: pano_unwrap.c:47
PANO_UNWRAP_CENTER_X
#define PANO_UNWRAP_CENTER_X
Definition: pano_unwrap.c:38
PANO_UNWRAP_OVERWRITE_VIDEO_THREAD
#define PANO_UNWRAP_OVERWRITE_VIDEO_THREAD
Definition: pano_unwrap.c:71
PANO_UNWRAP_CENTER_Y
#define PANO_UNWRAP_CENTER_Y
Definition: pano_unwrap.c:41
PANO_UNWRAP_VERTICAL_RESOLUTION
#define PANO_UNWRAP_VERTICAL_RESOLUTION
Definition: pano_unwrap.c:57
FALSE
#define FALSE
Definition: std.h:5
PANO_UNWRAP_HEIGHT
#define PANO_UNWRAP_HEIGHT
Definition: pano_unwrap.c:67