Go to the documentation of this file.00001 #ifndef brip_para_cvrg_h
00002 #define brip_para_cvrg_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <brip/brip_para_cvrg_params.h>
00035 #include <vil/vil_image_view.h>
00036 #include <vil/vil_image_resource_sptr.h>
00037 #include <vil/vil_rgb.h>
00038 #include <vcl_vector.h>
00039 class brip_para_cvrg : public brip_para_cvrg_params
00040 {
00041
00042
00043 public:
00044
00045
00046 brip_para_cvrg(float sigma = 1.0, float low = 6,
00047 float gauss_tail = .05,
00048 int proj_width = 7, int proj_height=1,
00049 int sup_radius = 1,
00050 bool verbose = true);
00051
00052 brip_para_cvrg(brip_para_cvrg_params& pdp);
00053 ~brip_para_cvrg();
00054 void do_coverage(vil_image_resource_sptr const& image);
00055
00056
00057 vil_image_view<float> get_float_detection_image(const float max = 255);
00058 vil_image_view<unsigned char> get_detection_image();
00059 vil_image_view<unsigned char> get_dir_image();
00060 vil_image_view<vil_rgb<unsigned char> > get_combined_image();
00061
00062 private:
00063 void init(vil_image_resource_sptr const & image);
00064 void init_variables();
00065 void set_kernel();
00066 void smooth_image();
00067 void avg(int x, int y, vil_image_view<float> const& smooth,
00068 vil_image_view<float>& avg);
00069 void grad0(int x, int y, vil_image_view<float> const& smooth,
00070 vil_image_view<float>& grad0);
00071 void grad45(int x, int y, vil_image_view<float> const& smooth,
00072 vil_image_view<float>& grad45);
00073 void grad90(int x, int y, vil_image_view<float> const& smooth,
00074 vil_image_view<float>& grad90);
00075 void grad135(int x, int y, vil_image_view<float> const& smooth,
00076 vil_image_view<float>& grad135);
00077 void compute_gradients();
00078 float project(int x, int y, int dir, vcl_vector<float>& projection);
00079 void remove_flat_peaks(int n, vcl_vector<float>& array);
00080 void non_maximum_supress(vcl_vector<float> const& array, vcl_vector<float>& sup_array);
00081 float parallel_coverage(vcl_vector<float> const& sup_array);
00082 void compute_parallel_coverage();
00083 void compute_image(vil_image_view<float> const& data,
00084 vil_image_view<unsigned char>& image);
00085
00086
00087 int proj_n_;
00088 int width_;
00089 int k_size_;
00090 vcl_vector<float> kernel_;
00091
00092 int xstart_, ystart_;
00093 int xsize_, ysize_;
00094 vil_image_view<float> smooth_;
00095 vil_image_view<float> avg_;
00096 vil_image_view<float> grad0_;
00097 vil_image_view<float> grad45_;
00098 vil_image_view<float> grad90_;
00099 vil_image_view<float> grad135_;
00100 vil_image_view<float> det_;
00101 vil_image_view<float> dir_;
00102
00103 vil_image_view<unsigned char> det_image_;
00104
00105 vil_image_view<unsigned char> dir_image_;
00106 vil_image_view<float> image_;
00107 vcl_vector<float> sup_proj_;
00108 vcl_vector<float> proj_0_;
00109 vcl_vector<float> proj_45_;
00110 vcl_vector<float> proj_90_;
00111 vcl_vector<float> proj_135_;
00112 };
00113
00114 #endif