Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
video_thread_nps.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 // Own header
28 #include "video_thread.h"
29 #include "cv.h"
30 
31 // Initialize the video_thread structure with the defaults
33  .is_running = FALSE,
34  .fps = 30,
35  .take_shot = FALSE,
36  .shot_number = 0
37 };
38 
39 // All dummy functions
40 void video_thread_init(void) {}
42 {
43  struct image_t img;
44  image_create(&img, 320, 240, IMAGE_YUV422);
45  int i, j;
46  uint8_t u, v;
47 
48 #ifdef SMARTUAV_SIMULATOR
49  SMARTUAV_IMPORT(&img);
50 #else
51  if (video_thread.is_running) {
52  u = 0;
53  v = 255;
54  } else {
55  u = 255;
56  v = 0;
57  }
58  uint8_t *p = (uint8_t *) img.buf;
59  for (j = 0; j < img.h; j++) {
60  for (i = 0; i < img.w; i += 2) {
61  *p++ = u;
62  *p++ = j;
63  *p++ = v;
64  *p++ = j;
65  }
66  }
67  video_thread.is_running = ! video_thread.is_running;
68 #endif
69 
70  cv_run(&img);
71 
72  image_free(&img);
73 }
74 
75 void video_thread_start(void) {}
76 void video_thread_stop(void) {}
77 void video_thread_take_shot(bool_t take __attribute__((unused))) {}
void video_thread_start(void)
Start with streaming.
struct video_thread_t video_thread
Dummy C implementation for simulation The V4L2 could also work in simulation, but must be adapted a b...
void image_free(struct image_t *img)
Free the image.
Definition: image.c:63
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
Definition: image.c:38
Start a Video thread and grab images.
Definition: image.h:42
void video_thread_take_shot(bool_t take)
Take a shot and save it This will only work when the streaming is enabled.
void video_thread_stop(void)
Stops the streaming This could take some time, because the thread is stopped asynchronous.
void video_thread_init(void)
Initialize the view video.
#define FALSE
Definition: std.h:5
uint16_t w
Image width.
Definition: image.h:44
Computer vision framework for onboard processing.
uint16_t h
Image height.
Definition: image.h:45
void * buf
Image buffer (depending on the image_type)
Definition: image.h:50
volatile bool_t is_running
When the device is running.
Definition: video_thread.h:37
void video_thread_periodic(void)
A dummy for now.
unsigned char uint8_t
Definition: types.h:14
UYVY format (uint16 per pixel)
Definition: image.h:35
static float p[2][2]
void cv_run(struct image_t *img)
Definition: cv.c:43