33#ifndef PANO_UNWRAP_CAMERA
34#define PANO_UNWRAP_CAMERA bottom_camera
37#ifndef PANO_UNWRAP_CENTER_X
38#define PANO_UNWRAP_CENTER_X 0.50
40#ifndef PANO_UNWRAP_CENTER_Y
41#define PANO_UNWRAP_CENTER_Y 0.50
43#ifndef PANO_UNWRAP_RADIUS_BOTTOM
44#define PANO_UNWRAP_RADIUS_BOTTOM 0.20
46#ifndef PANO_UNWRAP_RADIUS_TOP
47#define PANO_UNWRAP_RADIUS_TOP 0.30
49#ifndef PANO_UNWRAP_FORWARD_DIRECTION
50#define PANO_UNWRAP_FORWARD_DIRECTION 270.0
52#ifndef PANO_UNWRAP_FLIP_HORIZONTAL
53#define PANO_UNWRAP_FLIP_HORIZONTAL FALSE
56#ifndef PANO_UNWRAP_VERTICAL_RESOLUTION
57#define PANO_UNWRAP_VERTICAL_RESOLUTION 0.18
59#ifndef PANO_UNWRAP_DEROTATE_ATTITUDE
60#define PANO_UNWRAP_DEROTATE_ATTITUDE FALSE
63#ifndef PANO_UNWRAP_WIDTH
64#define PANO_UNWRAP_WIDTH 640
66#ifndef PANO_UNWRAP_HEIGHT
67#define PANO_UNWRAP_HEIGHT 0
70#ifndef PANO_UNWRAP_OVERWRITE_VIDEO_THREAD
71#define PANO_UNWRAP_OVERWRITE_VIDEO_THREAD TRUE
74#ifndef PANO_UNWRAP_FPS
75#define PANO_UNWRAP_FPS 0
96 .show_calibration =
FALSE,
101#define PIXEL_U(img,x,y) ( ((uint8_t*)((img)->buf))[4*(int)((x)/2) + 2*(y)*(img)->w] )
102#define PIXEL_V(img,x,y) ( ((uint8_t*)((img)->buf))[4*(int)((x)/2) + 2*(y)*(img)->w + 2] )
103#define PIXEL_Y(img,x,y) ( ((uint8_t*)((img)->buf))[2*(x) + 1 + 2*(y)*(img)->w] )
139 printf(
"[pano_unwrap] Automatic output image height: %d\n",
145 printf(
"[pano_unwrap] Creating output image with size %d x %d\n",
159 LUT.settings.forward_direction ==
pano_unwrap.forward_direction &&
167 printf(
"[pano_unwrap] Regenerating LUT... ");
189 printf(
"[pano_unwrap] ERROR could not allocate x or y lookup table!\n");
193 float angle = (
pano_unwrap.forward_direction / 180.0 * M_PI)
194 + bearing * (
pano_unwrap.flip_horizontal ? 1.f : -1.f);
195 float c = cosf(angle);
196 float s = sinf(angle);
211 if (!
LUT.dphi || !
LUT.dtheta) {
213 "[pano_unwrap] ERROR could not allocate dphi or dtheta lookup table!\n");
217 float angle = (
pano_unwrap.forward_direction / 180.0 * M_PI)
218 + bearing * (
pano_unwrap.flip_horizontal ? 1.f : -1.f);
219 LUT.dphi[u].x = sinf(bearing) * cosf(angle);
220 LUT.dphi[u].y = sinf(bearing) * -sinf(angle);
221 LUT.dtheta[u].x = cosf(bearing) * cosf(angle);
222 LUT.dtheta[u].y = cosf(bearing) * -sinf(angle);
254 }
else if (x > img_raw->
w - 1) {
259 }
else if (y > img_raw->
h - 1) {
291 for (
int i = -5; i <= 5; i++) {
292 for (
int j = -5; j <= 5; j++) {
293 if (i == 0 || j == 0) {
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps, uint8_t id)
Computer vision framework for onboard processing.
#define MAT33_ELMT(_m, _row, _col)
static struct FloatRMat * stateGetNedToBodyRMat_f(void)
Get vehicle body attitude rotation matrix (float).
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.
struct timeval ts
The timestamp of creation.
uint32_t pprz_ts
The timestamp in us since system startup.
@ IMAGE_YUV422
UYVY format (uint16 per pixel).
#define PANO_UNWRAP_RADIUS_TOP
#define PANO_UNWRAP_DEROTATE_ATTITUDE
static void set_output_image_size(void)
#define PANO_UNWRAP_FORWARD_DIRECTION
#define PIXEL_U(img, x, y)
#define PANO_UNWRAP_HEIGHT
#define PANO_UNWRAP_CENTER_X
static void unwrap_LUT(struct image_t *img_raw, struct image_t *img)
#define PANO_UNWRAP_WIDTH
struct image_t pano_unwrapped_image
Unwrapped panoramic image.
#define PANO_UNWRAP_CAMERA
#define PIXEL_Y(img, x, y)
#define PANO_UNWRAP_OVERWRITE_VIDEO_THREAD
struct pano_unwrap_t pano_unwrap
#define PANO_UNWRAP_CENTER_Y
#define PANO_UNWRAP_FLIP_HORIZONTAL
static void update_LUT(const struct image_t *img)
#define PIXEL_V(img, x, y)
static struct image_t * camera_cb(struct image_t *img, uint8_t camera_id)
#define PANO_UNWRAP_VERTICAL_RESOLUTION
struct FloatVect2 * dtheta
struct pano_unwrap_t settings
#define PANO_UNWRAP_RADIUS_BOTTOM
API to get/set the generic vehicle states.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.