5 void quicksort(
double *array,
int begin,
int end);
11 double theta_from_u[laser_ref->
nrays];
14 for(j=0;j<laser_ref->
nrays;j++) {
21 sm_debug(
"\tvisibility: Found outliers: ");
23 for(j=1;j<laser_ref->
nrays;j++) {
25 if(theta_from_u[j]<theta_from_u[j-1]) {
26 laser_ref->
valid[j] = 0;
48 double dist2_i[laser_sens->
nrays];
49 double dist2_j[laser_ref->
nrays];
50 int j;
for(j=0;j<laser_ref->
nrays;j++)
54 for(i=0;i<laser_sens->
nrays;i++) {
56 int j1 = laser_sens->
corr[i].
j1;
58 dist2_j[j1] = GSL_MIN(dist2_j[j1], dist2_i[i]);
62 for(i=0;i<laser_sens->
nrays;i++) {
64 int j1 = laser_sens->
corr[i].
j1;
65 if(dist2_i[i] > (threshold*threshold)*dist2_j[j1]) {
70 sm_debug(
"\tkill_outliers_double: killed %d correspondences\n",nkilled);
92 double dist2[laser_sens->
nrays];
95 double dist[laser_sens->
nrays];
97 for(i=0;i<laser_sens->
nrays;i++) {
100 double *p_i_w = laser_sens->
points_w[i].
p;
102 int j1 = laser_sens->
corr[i].
j1;
103 int j2 = laser_sens->
corr[i].
j2;
117 double dist2_copy[k];
for(i=0;i<k;i++) dist2_copy[i] = dist2[i];
123 order = GSL_MAX(0, GSL_MIN(order, k-1));
128 double error_limit1 = dist2[order];
134 order2 = GSL_MAX(0, GSL_MIN(order2, k-1));
137 double error_limit = GSL_MIN(error_limit1, error_limit2);
141 double error_limit2_ho = error_limit2;
142 if((error_limit1_ho != error_limit1) || (error_limit2_ho != error_limit2)) {
143 printf(
"%f == %f %f == %f\n",
144 error_limit1_ho, error_limit1, error_limit2_ho, error_limit2);
153 sm_debug(
"\ticp_outliers: maxPerc %f error_limit: fix %f adaptive %f \n",
158 for(i=0;i<laser_sens->
nrays;i++) {
160 if(dist[i] > error_limit) {
162 laser_sens->
corr[i].
j1 = -1;
163 laser_sens->
corr[i].
j2 = -1;
166 *total_error += dist[i];
170 sm_debug(
"\ticp_outliers: valid %d/%d (limit: %f) mean error = %f \n",nvalid,k,error_limit,
171 *total_error/nvalid);
182 double t = *a; *a = *b; *b=t;
188 double pivot = array[begin];
192 if (array[l] < pivot) {
211 int pivotIndex, i, j;
212 float pivotValue, tmp;
216 pivotIndex = start + (end-start)/2;
217 pivotValue = data[pivotIndex];
222 while(data[i] < pivotValue)
224 while(data[j] > pivotValue)
void jj_add_int(const char *name, int v)
INLINE int ld_valid_corr(LDP ld, int i)
double hoare_selection(double *data, int start, int end, int k)
INLINE int ld_valid_ray(LDP ld, int i)
void visibilityTest(LDP laser_ref, const gsl_vector *u)
double outliers_adaptive_mult
void swap_double(double *a, double *b)
void kill_outliers_double(struct sm_params *params)
void kill_outliers_trim(struct sm_params *params, double *total_error)
point2d *restrict points_w
double dist_to_segment_d(const double a[2], const double b[2], const double x[2])
void jj_add_double(const char *name, double v)
struct correspondence *restrict corr
void quicksort(double *array, int begin, int end)
void jj_add_double_array(const char *name, double *v, int n)
void sm_debug(const char *msg,...)
double outliers_adaptive_order
void jj_context_enter(const char *context_name)