Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/computer_vision/video_thread.h"
#include "modules/computer_vision/cv.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <math.h>
#include "lib/v4l/v4l2.h"
#include "lib/vision/image.h"
#include "lib/vision/bayer.h"
#include "lib/encoding/jpeg.h"
#include "peripherals/video_device.h"
#include "mcu_periph/sys_time.h"
#include <BOARD_CONFIG>
#include <pthread.h>
#include "rt_priority.h"
Go to the source code of this file.
Macros | |
#define | VIDEO_THREAD_DEVICE_BUFFERS 10 |
The camera video config (usually bottom_camera or front_camera) More... | |
#define | VIDEO_THREAD_SUBDEV NULL |
#define | VIDEO_THREAD_FILTERS 0 |
#define | VIDEO_THREAD_CAMERA custom_camera |
#define | VIDEO_THREAD_FPS 4 |
#define | VIDEO_THREAD_SHOT_PATH "/data/video/images" |
#define | IMG_FLT_SIZE 272 |
Functions | |
static void * | video_thread_function (void *data) |
Handles all the video streaming and saving of the image shots This is a sepereate thread, so it needs to be thread safe! More... | |
void | video_thread_periodic (void) |
A dummy for now. More... | |
static void | video_thread_save_shot (struct image_t *img, struct image_t *img_jpeg) |
void | video_thread_init (void) |
Initialize the view video. More... | |
void | video_thread_start (void) |
Start with streaming. More... | |
void | video_thread_stop (void) |
Stops the streaming This could take some time, because the thread is stopped asynchronous. More... | |
void | video_thread_take_shot (bool_t take) |
Take a shot and save it This will only work when the streaming is enabled. More... | |
Variables | |
struct video_config_t | custom_camera |
struct video_thread_t | video_thread |
#define IMG_FLT_SIZE 272 |
Referenced by video_thread_function().
#define VIDEO_THREAD_CAMERA custom_camera |
Definition at line 79 of file video_thread.c.
Referenced by video_thread_function(), video_thread_init(), and video_thread_start().
#define VIDEO_THREAD_DEVICE_BUFFERS 10 |
The camera video config (usually bottom_camera or front_camera)
Definition at line 62 of file video_thread.c.
#define VIDEO_THREAD_FILTERS 0 |
Definition at line 69 of file video_thread.c.
#define VIDEO_THREAD_FPS 4 |
Definition at line 86 of file video_thread.c.
#define VIDEO_THREAD_SHOT_PATH "/data/video/images" |
Definition at line 92 of file video_thread.c.
Referenced by video_thread_init(), and video_thread_save_shot().
#define VIDEO_THREAD_SUBDEV NULL |
Definition at line 66 of file video_thread.c.
|
static |
Handles all the video streaming and saving of the image shots This is a sepereate thread, so it needs to be thread safe!
Definition at line 145 of file video_thread.c.
References BayerToYUV(), cv_run(), video_thread_t::dev, FALSE, video_config_t::filters, video_thread_t::fps, video_config_t::h, image_create(), image_free(), IMAGE_JPEG, IMAGE_YUV422, IMG_FLT_SIZE, video_thread_t::is_running, v4l2_device::name, set_nice_level(), sys_time_elapsed_us(), video_thread_t::take_shot, TRUE, v4l2_image_free(), v4l2_image_get(), v4l2_start_capture(), VIDEO_FILTER_DEBAYER, VIDEO_THREAD_CAMERA, video_thread_save_shot(), and video_config_t::w.
Referenced by video_thread_start().
void video_thread_init | ( | void | ) |
Initialize the view video.
Definition at line 234 of file video_thread.c.
void video_thread_periodic | ( | void | ) |
A dummy for now.
Definition at line 98 of file video_thread.c.
Definition at line 108 of file video_thread.c.
References image_t::buf, image_t::buf_size, image_t::h, jpeg_encode_image(), video_thread_t::shot_number, TRUE, VIDEO_THREAD_SHOT_PATH, image_t::w, and write_exif_jpeg().
Referenced by video_thread_function().
void video_thread_start | ( | void | ) |
Start with streaming.
Definition at line 266 of file video_thread.c.
void video_thread_stop | ( | void | ) |
Stops the streaming This could take some time, because the thread is stopped asynchronous.
Definition at line 285 of file video_thread.c.
void video_thread_take_shot | ( | bool_t | take | ) |
Take a shot and save it This will only work when the streaming is enabled.
Definition at line 308 of file video_thread.c.
Referenced by cv_blob_locator_periodic(), and dc_send_command().
struct video_config_t custom_camera |
Definition at line 71 of file video_thread.c.
struct video_thread_t video_thread |
Definition at line 101 of file video_thread.c.