mtt_auxiliar_pedect.cpp
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
32 #include <mtt/mtt_auxiliar.h>
33 
34 void init_config(t_config*config)
35 {
36  config->maxr=30.; //in meters
37 
38  config->in_clip=0.1; //in meters
39  config->out_clip=config->maxr;
40 
41  config->in_angle= 0; //Radians
42  config->out_angle= 2*M_PI; //Radians
43 
44  // config->cluster_break_distance=10;
45  // config->cluster_break_distance=100;
46  config->cluster_break_distance=10.;
47 // config->cluster_break_distance=1000;
48 // config->cluster_break_distance=1000;
49 // config->cluster_break_distance=0.5;
50 
51  config->fi=5.0*(M_PI/180.);//clustering parameters
52 // config->fi=90*(M_PI/180.);//clustering parameters
53  config->beta=60*(M_PI/180.);
54 // config->C0=200.;
55  // config->C0=2000.;
56  config->C0=0.2;
57 
58  config->filter_max_variation=0.001;//used in raw data filter, in m
59 
60 // config->excluding_dr=2.50;
61  config->excluding_dr=250;
62 
63  config->point_occlusion_distance=500.; //used in point occlusion calculation
64  // config->point_occlusion_distance=2000; //used in point occlusion calculation
65  // config->point_occlusion_distance=250; //used in point occlusion calculation
66 
67  config->max_line_per_object=1000;//used in lines
68  config->max_mean_variance=0.1;//used in lines
69  // config->max_mean_variance=5;//used in lines
70 
71  config->data_acc_scans=20;
72  // config->data_acc_scans=50;
73 
74  config->max_missing_iterations=30;
75  // config->max_missing_iterations=50;
76 
77  config->overlap_max=5;
78  config->overlap_distance=0.2;
79 
80  config->display_min_lifetime=10;
81 
82  // config->dt=1./13.;
83  config->dt=1./30.;
84  // config->dt=1./40.;
85 // config->dt=1./50.;
86  // config->dt=1./10.;
87 
88  config->estimation_window_size=2; //estimation window size for all the error vectors
89 
90  config->max_stationary_velocity=0.030;
91  config->min_moving_velocity=0.100;
92 
93  config->velocity_acc_size=10;
94 
95  config->path_lenght=1000;
96 
97 // config->default_ellipse_axis=0.500;
98 // config->max_ellipse_axis=2.000;
99 // config->min_ellipse_axis=0.050;
100 
101  config->default_ellipse_axis=0.500;
102  config->max_ellipse_axis=1.500;
103  config->min_ellipse_axis=0.050;
104 
105  config->ezA=1.0;
106  config->ezB=0.5;
107 }
108 
109 void init_flags(t_flag*flags)
110 {
111  flags->fp_s=true;
112  flags->fi=true;
113 }
114 
115 double get_fps(double dt,t_fps*acc)
116 {
117  static bool initialise=true;
118  static unsigned int max_size=30;
119 
120  if(initialise)
121  {
122  memset(acc->fps,0,max_size*sizeof(double));
123  acc->position=0;
124  acc->current_size=0;
125 
126  initialise=false;
127  }
128 
129  acc->fps[acc->position]=1./(double)dt;
130  acc->position++;
131 
132  if(acc->current_size<max_size)
133  acc->current_size++;
134 
135  if(acc->position==max_size)
136  acc->position=0;
137 
138  double mean_fps=0;
139 
140  for(unsigned int i=0;i<acc->current_size;i++)
141  mean_fps+=acc->fps[i];
142 
143  mean_fps/=acc->current_size;
144 
145  return mean_fps;
146 }
147 
148 int my_tictoc(int status)
149 {
150  static struct timeval timestart;
151  struct timeval timenow;
152 
153  if(status==TIC)
154  {
155  gettimeofday(&timestart,NULL);
156  return 0;
157  }else if (status==TOC)
158  {
159  gettimeofday(&timenow,NULL);
160  int ret=timediff(timenow,timestart);
161  return ret;
162  }else
163  return -1;
164 }
165 
166 int timediff(struct timeval t1,struct timeval t2)
167 {
168  return (t1.tv_sec-t2.tv_sec)*1000000+(t1.tv_usec-t2.tv_usec);
169 }
170 
171 double point2point_distance(double xi,double yi,double xf,double yf)
172 { return sqrt((xi-xf)*(xi-xf)+(yi-yf)*(yi-yf));}
173 
174 double point2point_algebric_distance(double xi,double yi,double xf,double yf)
175 { return (xi-xf)*(xi-xf)+(yi-yf)*(yi-yf);}
176 
177 double point2line_distance(double alpha,double ro,double x,double y)
178 { return ro-x*cos(alpha)-y*sin(alpha);}
unsigned int path_lenght
Definition: mtt_common.h:181
#define TOC
Definition: mtt_auxiliar.h:38
double max_stationary_velocity
Definition: mtt_common.h:178
double point2line_distance(double alpha, double ro, double x, double y)
Calculates the line to point distance.
double min_moving_velocity
Definition: mtt_common.h:179
double fps[100]
Accumulator.
Definition: mtt_common.h:420
double in_angle
Definition: mtt_common.h:140
unsigned int display_min_lifetime
Minimum lifetime before the object appears (in iterations)
Definition: mtt_common.h:168
double C0
Definition: mtt_common.h:146
unsigned int position
Position the accumulator.
Definition: mtt_common.h:422
unsigned int current_size
Current size of accumulator.
Definition: mtt_common.h:424
int timediff(struct timeval t1, struct timeval t2)
Calculates timediff.
void init_flags(t_flag *flags)
Init flags.
double min_ellipse_axis
Definition: mtt_common.h:186
double ezB
Definition: mtt_common.h:189
double excluding_dr
Maximum dr that can exist between two consecutive points in any given object, this value is used to c...
Definition: mtt_common.h:160
bool fi
Definition: mtt_common.h:372
double point2point_algebric_distance(double xi, double yi, double xf, double yf)
Calculates the algebric distante between two points.
int max_line_per_object
Definition: mtt_common.h:151
double point2point_distance(double xi, double yi, double xf, double yf)
Calculates the distante between two points.
void init_config(t_config *config)
Init configuration.
Iterations per second structure.
Definition: mtt_common.h:417
Auxiliary functions header for the mtt tracking.
#define TIC
Definition: mtt_auxiliar.h:37
double maxr
Definition: mtt_common.h:139
double cluster_break_distance
Definition: mtt_common.h:182
double dt
Time interval between two consecutive iterations.
Definition: mtt_common.h:174
unsigned int estimation_window_size
This is used to set the size of the error vectors, innovations and residual.
Definition: mtt_common.h:172
unsigned int velocity_acc_size
Definition: mtt_common.h:176
double fi
Parameters for the dietmayer clustering.
Definition: mtt_common.h:146
int my_tictoc(int status)
TIC TOC implementation functions.
double out_clip
Definition: mtt_common.h:139
double in_clip
Definition: mtt_common.h:139
double max_ellipse_axis
Definition: mtt_common.h:185
double ezA
Definition: mtt_common.h:188
double out_angle
Definition: mtt_common.h:140
double default_ellipse_axis
Definition: mtt_common.h:184
double overlap_distance
Maximum distance between two object for the to overlap each other.
Definition: mtt_common.h:166
double get_fps(double dt, t_fps *acc)
int max_missing_iterations
Maximum number of iterations that an object can failure detection.
Definition: mtt_common.h:162
double beta
Definition: mtt_common.h:146
int overlap_max
Maximum number of iterations that an object can overlap another.
Definition: mtt_common.h:164
double filter_max_variation
This is used to avoid calculating the mean in the raw data filter when points are to far apart...
Definition: mtt_common.h:158
This structure contains global configurations parameters.
Definition: mtt_common.h:137
int data_acc_scans
Number of scans to accumulate.
Definition: mtt_common.h:156
double point_occlusion_distance
This variable is used when calculating the occluded points, in mm.
Definition: mtt_common.h:170
This structure contains global flags parameters.
Definition: mtt_common.h:369
double max_mean_variance
for the iepf
Definition: mtt_common.h:153
bool fp_s
first point of scan, first image
Definition: mtt_common.h:372


mtt
Author(s): Jorge Almeida
autogenerated on Mon Mar 2 2015 01:32:18