/* dsm_common.h - types and utilities for vehicle segmentation. */ /* Last edited on 2016-04-09 11:20:31 by stolfilocal */ #ifndef dsm_common_H #define dsm_common_H #define _GNU_SOURCE #include #include #include #define NUM_OF_BUFFERED_FRAMES 2 /* Defines the common data (shared) between the gstreamer plugin part and the vehicle-dsm module. */ typedef struct dsm_common_data_t { const char *output_path; /**< Path to output folder. */ const char *groundtruh_file; /**< Path to groundtruth file. */ const char *vehicles_xml; /**< Path to vehicles.xml file. */ long int iframe; /* Index of the current frame from video. */ uint8_t* framebuf[NUM_OF_BUFFERED_FRAMES]; /*Pixels of most recent frames (color) */ int icurr; /* Index of the current frame. */ int nhold; /* Number of hold buffers. */ /* FIXME: verify when the timestamp will overflow. */ double timestamp; int tp; /*true positive*/ int fp; /*false positive*/ int fn; /*false negative*/ int positives; /*groundtruth*/ /*The visual rythm images:*/ int vr_nx; /*Width of extracted visual rythm and related images.*/ int vr_ny; /*Only rows 0..vr_ny-1 of the visual rythm images are defined.*/ dsm_image_t visual_events; dsm_image_t visual_update; dsm_image_t visual_diff; dsm_image_t visual_rythm0; /* Y0[t][j]Visual rythm from upstream reference row.*/ dsm_image_t visual_rythm1; /* Y1[t][j]Visual rythm from downstream refernce row.*/ dsm_image_t visual_background; /*F[t][j] = the estimated background for Y1[t][j].*/ dsm_image_t visual_weights; /*W[t][j] = the background-rythm similarity weight.*/ dsm_image_t visual_segmentation; dsm_image_t visual_segmentation_band; dsm_image_t visual_velx; /* Estimated velocity along downstream visual rythm row. */ dsm_image_t visual_vely; /* Estimated velocity across downstream visual rythm row. */ double *visual_gain; /*G[t] = estimated camera gain for each frame t.*/ } dsm_common_data_t; /* Returns a pointer to the pixels of a recent color frame. The {index} should be 0 for the current buffer, 1 for the first past buffer, 2, ..., NUM_OF_BUFFERED_FRAMES - 1. */ uint8_t *grab_past_buffer(dsm_common_data_t *cd, int index); #endif