[video_thread] simulation

This commit is contained in:
Christophe De Wagter
2015-09-03 13:22:07 +02:00
parent 16bbf7df01
commit acffa6769d
4 changed files with 36 additions and 38 deletions
+9 -11
View File
@@ -20,7 +20,7 @@
*/
/**
* @file modules/computer_vision/cv.h
* @file modules/computer_vision/cv.c
*
* Computer vision framework for onboard processing
*/
@@ -34,17 +34,15 @@ cvFunction cv_func[MAX_CV_FUNC];
void cv_add(cvFunction func)
{
if (cv_func_cnt < (MAX_CV_FUNC-1))
{
cv_func[cv_func_cnt] = func;
cv_func_cnt++;
}
if (cv_func_cnt < (MAX_CV_FUNC - 1)) {
cv_func[cv_func_cnt] = func;
cv_func_cnt++;
}
}
void cv_run(struct image_t* img)
void cv_run(struct image_t *img)
{
for (int i=0;i<cv_func_cnt;i++)
{
cv_func[i](img);
}
for (int i = 0; i < cv_func_cnt; i++) {
cv_func[i](img);
}
}
+2 -2
View File
@@ -32,9 +32,9 @@
#include "std.h"
#include "lib/vision/image.h"
typedef bool_t (*cvFunction)(struct image_t* img);
typedef bool_t (*cvFunction)(struct image_t *img);
extern void cv_add(cvFunction func);
extern void cv_run(struct image_t* img);
extern void cv_run(struct image_t *img);
#endif /* CV_H_ */
@@ -1,23 +1,23 @@
/*
* Copyright (C) 2015
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
/*
* Copyright (C) 2015
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
/**
* @file modules/computer_vision/video_thread.c
@@ -99,8 +99,8 @@ struct viewvideo_t viewvideo = {
* This is a sepereate thread, so it needs to be thread safe!
*/
struct UdpSocket video_sock;
bool_t viewvideo_function(struct image_t* img);
bool_t viewvideo_function(struct image_t* img)
bool_t viewvideo_function(struct image_t *img);
bool_t viewvideo_function(struct image_t *img)
{
// Resize image if needed
struct image_t img_small;
@@ -187,13 +187,13 @@ bool_t viewvideo_function(struct image_t* img)
*/
void viewvideo_init(void)
{
char save_name[512];
char save_name[512];
// struct UdpSocket video_sock;
udp_socket_create(&video_sock, STRINGIFY(VIEWVIDEO_HOST), VIEWVIDEO_PORT_OUT, -1, VIEWVIDEO_BROADCAST);
cv_add(viewvideo_function);
cv_add(viewvideo_function);
viewvideo.is_streaming = TRUE;
viewvideo.is_streaming = TRUE;
#if VIEWVIDEO_USE_NETCAT
// Create an Netcat receiver file for the streaming