/* vehicle-speed.h */ /* Last edited on 2016-04-09 00:31:01 by stolfilocal */ /* Based on code by Diogo Luvizon 29/01/2014 */ #ifndef vehicle_speed_H #define vehicle_speed_H #include #include #include /* Input files. */ #define SVM_MODEL_FILE "./input/model.svm" #define THOG_SETTINGS_FILE "./input/1_7_9.txt" typedef struct dsm_vs_data_t { int last; unsigned long object_counter; const char *out_path; /* Image parameters. */ int img_nx; int img_ny; /* KLT */ KLT_TrackingContext tc; KLT_TrackingContext tc_gt; vector features; vector features_gt; struct klt_buffers kltbufs; struct lane_limits lanes; struct sub_data *background_sub; struct vehicle_table *vt; struct snoopertext snooper; bool_t should_save_frame; int start_row; /*Last image row scanned by the connected components algorithm.*/ /*Parameters for visual rythm extraction: */ int yext0; /*index of the upstream rythm line to be extracted from each frame. */ int yext1; /*index of the downstream rythm line to be extracted from each frame. */ int xreduc; /*width reduction factor.*/ int yreduc; /*height reduction factor.*/ int nyredw; /*number of lines to be averaged when extracting a rythm line.*/ int nxredw; /*number of pixels to be averaged for smoothing a rythm line.*/ /*Parameters for background estimation:*/ int band_ny; /*height of band to be extract around visual rythm row.*/ double cleanup_bg; /*Erosion/dilation radius for weight clean-up.*/ double sigma_bg; /*estimated standard deviation of noise in background. */ double lambda_bg; /*expected log discrepancy between background pixels in image and reference background.*/ dsm_image_t background; /*the background reference image (full size).*/ /* Extracted and reduced image bands */ dsm_image_t background_red; /*Band extracted from background image (downstream).*/ dsm_image_t img0_red; /*Band extracted from current frame (upstream).*/ dsm_image_t img1_red; /*Band extracted from current frame (downstream).*/ dsm_image_t weight_red; /*Background classification weight for {img1_red}.*/ /* Blurred versions of reduced band images aroun downstream row: */ dsm_image_t background_red_blur; /*Blurred version of {background_red}.*/ dsm_image_t img0_red_blur; /*Blurred version of {img0_red}.*/ dsm_image_t img1_red_blur; /*Blurred version of {img1_red}.*/ dsm_image_t weight_red_blur; /*Blurred version of {weight_red}.*/ /* Work images for bands extracted from full-width frames: */ dsm_image_t temp_band; /* Work images for full-length visual rythm images: */ dsm_image_t temp_vr; /*Parameters for background update:*/ int ynlines_bg; /*how many frames to consider.*/ double tau_bg; /*EMA decay parameter.*/ double beta_bg; /*Background update fraction.*/ /*Work vectors*/ double *vect_F; double *vect_X; double *img_row0; /* Y0 = extracted image pixels from upstream visual rythm row. */ double *img_row1; /* Y1 = extracted image pixels from downstream visual rythm row. */ double *bg_row1; /* Visual rythm row (downstream) extracted from the background frame.*/ double *weight; /* W = background indicator weigths for {img_row1}. */ int beg; int end; vector R; /*unsigned char *diff_rythm; unsigned char *rythm; int *L; int pos_rythm; int nplates; unsigned char *background; */ } dsm_vs_data_t; #ifndef max # define max(a, b) ((a) > (b) ? (a) : (b)) #endif #ifndef min # define min(a, b) ((a) < (b) ? (a) : (b)) #endif #endif /* __VEHICLE_SPEED_H */