35 #include <sys/types.h>
42 #ifndef VIDEO_USB_LOGGER_PATH
43 #define VIDEO_USB_LOGGER_PATH /data/video/usb
46 #ifndef VIDEO_USB_LOGGER_FPS
47 #define VIDEO_USB_LOGGER_FPS 0
68 if (access(save_name, F_OK) == -1) {
73 #if VIDEO_USB_LOGGER_JPEG_WITH_EXIF_HEADER
74 write_exif_jpeg(save_name, img_jpeg->buf, img_jpeg->buf_size, img_jpeg->w, img_jpeg->h);
76 FILE *fp = fopen(save_name,
"w");
78 printf(
"[video_thread-thread] Could not write shot %s.\n", save_name);
81 fwrite(img_jpeg->buf,
sizeof(
uint8_t), img_jpeg->buf_size, fp);
83 printf(
"Wrote image\n");
102 fprintf(
video_usb_logger,
"%d,%d,%f,%f,%f,%d,%d,%d,%d,%d,%d,%f,%f,%f,%d\n",
counter,
105 ned->
x, ned->
y, ned->
z,
106 accel->
x, accel->
y, accel->
z,
132 struct stat st = {0};
143 snprintf(filename,
sizeof(filename),
"%s/log.csv",
foldername);
147 fprintf(
video_usb_logger,
"counter,image,roll,pitch,yaw,x,y,z,accelx,accely,accelz,ratep,rateq,rater,sonar\n");
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.
int write_exif_jpeg(char *filename, const unsigned char *image_jpg, const unsigned int image_jpg_len, const unsigned int image_jpg_x, const unsigned int image_jpg_y)
vector in North East Down coordinates
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
@ IMAGE_JPEG
An JPEG encoded image (not per pixel encoded)
void jpeg_encode_image(struct image_t *in, struct image_t *out, uint32_t quality_factor, bool add_dri_header)
Encode an YUV422 image.
Encode images with the use of the JPEG encoding.
std::shared_ptr< gazebo::sensors::SonarSensor > sonar
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
struct pose_t get_rotation_at_timestamp(uint32_t timestamp)
Given a pprz timestamp in used (obtained with get_sys_time_usec) we return the pose in FloatEulers cl...
struct FloatEulers eulers
API to get/set the generic vehicle states.
static FILE * video_usb_logger
The file pointer.
struct image_t img_jpeg_global
void video_usb_logger_periodic(void)
void video_usb_logger_start(void)
Start the file logger and open a new file.
#define VIDEO_USB_LOGGER_FPS
Default FPS (zero means run at camera fps)
void video_usb_logger_stop(void)
Stop the logger an nicely close the file.
static struct image_t * log_image(struct image_t *img, uint8_t camera_id)
static void save_shot_on_disk(struct image_t *img, struct image_t *img_jpeg)
#define VIDEO_USB_LOGGER_PATH
Set the default File logger path to the USB drive.
Camera image logger for Linux based autopilots.
Get live images from a RTP/UDP stream and save pictures on internal memory.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.