00001 #ifndef H_CSM_HSM
00002 #define H_CSM_HSM
00003
00004 #include <stdlib.h>
00007 struct hsm_params {
00009 double max_norm;
00011 double linear_cell_size;
00013 double angular_cell_size_deg;
00014
00016 int num_angular_hypotheses;
00017
00019 double angular_hyp_min_distance_deg;
00020
00021
00023 int xc_ndirections;
00024
00026 double xc_directions_min_distance_deg;
00027
00028
00030 int linear_xc_max_npeaks;
00031
00033 double linear_xc_peaks_min_distance;
00034
00035
00036
00037 double max_translation;
00038
00040 int debug_true_x_valid;
00042 double debug_true_x[3];
00043 };
00044
00045
00046 struct hsm_buffer_struct {
00050 int num_angular_cells;
00051
00053 int num_linear_cells;
00054
00056 double linear_cell_size;
00057
00059 double rho_min, rho_max;
00060
00062 double **ht;
00063
00065 double *hs;
00066
00070 int max_num_results;
00071
00073 int num_valid_results;
00074
00076 double **results;
00077
00079 double *results_quality;
00080
00081
00083 double *theta;
00084
00086 double *sint,*cost;
00087
00089 double *hs_cross_corr;
00090
00092 double disp[3];
00093 double disp_th_cos, disp_th_sin;
00094 };
00095
00096 typedef struct hsm_buffer_struct* hsm_buffer;
00097
00098
00100 hsm_buffer hsm_buffer_alloc(struct hsm_params*);
00101
00103 void hsm_buffer_free(hsm_buffer);
00104
00106 void hsm_compute_ht_point(hsm_buffer, double x, double y, double weight);
00107
00108
00109 void hsm_match(struct hsm_params*p, hsm_buffer b1, hsm_buffer b2);
00110
00114 void hsm_compute_ht_base(hsm_buffer, const double base_pose[3]);
00115
00117 void hsm_compute_spectrum(hsm_buffer);
00118
00119 void hsm_compute_spectrum_norm(hsm_buffer b);
00120
00124 void hsm_find_local_maxima_circ(int n, const double*f, int*maxima, int*nmaxima);
00125
00127 int hsm_is_angle_between_smaller_than_deg(double angle1, double angle2, double threshold_deg);
00128
00129
00132 int hsm_rho2index(hsm_buffer b, double rho, int *rho_index, double *alpha);
00133
00135 void hsm_circular_cross_corr_stupid(int n, const double *a, const double *b, double*res);
00136
00138 void hsm_find_peaks_circ(int n, const double*f, double min_angle_deg, int unidir, int max_peaks,
00139 int*peaks, int* npeaks) ;
00140
00141 void hsm_find_peaks_linear(int n, const double*f, double min_dist, int max_peaks,
00142 int*peaks, int* npeaks);
00143 void hsm_find_local_maxima_linear(int n, const double*f, int*maxima, int*nmaxima);
00144
00145 void hsm_linear_cross_corr_stupid(int na, const double *a, int nb, const double *b, double*res, int*lags, int min_lag, int max_lag);
00146
00147 void hsm_generate_combinations(int nslots, const int possible_choices[],
00148 int i, int i_choice[]) ;
00149
00150
00151 int pos_mod(int a, int b);
00152
00154 void qsort_descending(int *indexes, size_t nmemb, const double*values);
00155
00156
00157 int compare_descending(const void *index_pt1, const void *index_pt2);
00158
00159
00160 #endif