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
64 snprintf(save_name,
sizeof(save_name),
"%s/img_%05d.jpg", foldername, shotNumber);
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");
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
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...
void video_usb_logger_periodic(void)
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps)
Camera image logger for Linux based autopilots.
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)
struct FloatEulers eulers
#define VIDEO_USB_LOGGER_PATH
Set the default File logger path to the USB drive.
Computer vision framework for onboard processing.
struct image_t img_jpeg_global
Encode images with the use of the JPEG encoding.
void video_usb_logger_stop(void)
Stop the logger an nicely close the file.
static struct image_t * log_image(struct image_t *img)
Get live images from a RTP/UDP stream and save pictures on internal memory.
API to get/set the generic vehicle states.
vector in North East Down coordinates
void video_usb_logger_start(void)
Start the file logger and open a new file.
void jpeg_encode_image(struct image_t *in, struct image_t *out, uint32_t quality_factor, bool add_dri_header)
Encode an YUV422 image.
static void save_shot_on_disk(struct image_t *img, struct image_t *img_jpeg)
static FILE * video_usb_logger
The file pointer.
#define VIDEO_USB_LOGGER_FPS
Default FPS (zero means run at camera fps)
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
std::shared_ptr< gazebo::sensors::SonarSensor > sonar
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
An JPEG encoded image (not per pixel encoded)