Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
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 #include "lib/vision/image.h"
31 
32 
33 // Initialize the video_thread structure with the defaults
35  .is_running = FALSE
36 };
37 
38 // All dummy functions
39 void video_thread_init(void) {}
41 {
42  struct image_t img;
43  image_create(&img, 320, 240, IMAGE_YUV422);
44  int i, j;
45  uint8_t u, v;
46 
47 #ifdef SMARTUAV_SIMULATOR
48  SMARTUAV_IMPORT(&img);
49 #else
50  if (video_thread.is_running) {
51  u = 0;
52  v = 255;
53  } else {
54  u = 255;
55  v = 0;
56  }
57  uint8_t *p = (uint8_t *) img.buf;
58  for (j = 0; j < img.h; j++) {
59  for (i = 0; i < img.w; i += 2) {
60  *p++ = u;
61  *p++ = j;
62  *p++ = v;
63  *p++ = j;
64  }
65  }
66  video_thread.is_running = ! video_thread.is_running;
67 #endif
68 
69  // Calling this function will not work because video_config_t is NULL (?) and img
70  // has no timestamp
71  // Commenting out for now
72  // cv_run_device(NULL,&img);
73 
74  image_free(&img);
75 }
76 
77 void video_thread_start(void) {}
78 void video_thread_stop(void) {}
79 void video_thread_take_shot(bool take __attribute__((unused))) {}
80 
81 bool add_video_device(struct video_config_t *device __attribute__((unused))){ return true; }
void video_thread_start(void)
Starts the streaming of a all cameras.
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_stop(void)
Stops the streaming of all cameras This could take some time, because the thread is stopped asynchron...
void video_thread_init(void)
Initialize the view video.
#define FALSE
Definition: std.h:5
Image helper functions like resizing, color filter, converters...
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:51
void video_thread_periodic(void)
A dummy for now.
void video_thread_take_shot(bool take)
unsigned char uint8_t
Definition: types.h:14
volatile bool is_running
When the device is running.
Definition: video_device.h:39
UYVY format (uint16 per pixel)
Definition: image.h:35
static float p[2][2]
bool add_video_device(struct video_config_t *device)
V4L2 device settings.
Definition: video_device.h:44