contrib/gel/vmal/vmal_lines_correlation.h
Go to the documentation of this file.
00001 // This is gel/vmal/vmal_lines_correlation.h
00002 #ifndef vmal_lines_corrletation_h_
00003 #define vmal_lines_corrletation_h_
00004 //--------------------------------------------------------------------------------
00005 // .NAME        vmal_lines_correlation
00006 // .INCLUDE     vmal/vmal_lines_correlation
00007 // .FILE        vmal_lines_correlation.cxx
00008 // .SECTION Description:
00009 //   Compute the correlation between two lines. They must be of the same length
00010 //   and the first end-point of the first line must match with the first end-point
00011 //   of the second (the same thing for the second end-point). It means that before
00012 //   calling vmal_lines_correlation, you must have:
00013 //   - sort the two lines so their end-points are in the same order
00014 //   - refine the lines so their length is the same
00015 //   I created this class when I was working on lines matching. It means that
00016 //   the first line is transformed by a homography in the second image. Then, the
00017 //   the transformed line is projected on the second line after they had been sorted.
00018 //   Then, w apply the lines_correlation to see if the lines could match. But, the
00019 //   problem is that the homography may be not perfect and that the transformed line
00020 //   is not exactly at the good place. So, to solve that, we make a research along
00021 //   the transformed line to find a better correlation which will correct the error
00022 //   due to the homography.
00023 // .SECTION Author
00024 //   L. Guichard 29-May-2001
00025 // .SECTION Modifications:
00026 //--------------------------------------------------------------------------------
00027 
00028 #include <vnl/vnl_double_3.h>
00029 #include <vil1/vil1_memory_image_of.h>
00030 #include <vxl_config.h>
00031 
00032 class vmal_lines_correlation
00033 {
00034  public:
00035   vmal_lines_correlation();
00036 
00037   vmal_lines_correlation(int, double);
00038 
00039   ~vmal_lines_correlation();
00040 
00041   double find_min_corr(vnl_double_3 &line0p, vnl_double_3 &line0q,
00042                        vnl_double_3 &line1p, vnl_double_3 &line1q,
00043                        vil1_memory_image_of<vxl_byte> &image0,
00044                        vil1_memory_image_of<vxl_byte> &image1,
00045                        vnl_double_3 &trans);
00046 
00047   double lines_correlation(vnl_double_3 &line0_p, vnl_double_3 &line0_q,
00048                            vnl_double_3 &line1_p, vnl_double_3 &line1_q,
00049                            vil1_memory_image_of<vxl_byte> &image0,
00050                            vil1_memory_image_of<vxl_byte> &image1,
00051                            vnl_double_3 &trans, int bias);
00052 
00053   bool interpol_pixel(vnl_double_3 &pixel0, vnl_double_3 &pixel1,
00054                       vil1_memory_image_of<vxl_byte> &image0,
00055                       vil1_memory_image_of<vxl_byte> &image1,
00056                       unsigned char &value0, unsigned char &value1);
00057 
00058  private:
00059   int delta_;
00060   double radius_;
00061 };
00062 
00063 #endif // vmal_lines_corrletation_h_