Go to the documentation of this file.00001
00002 #ifndef SimilarityMetric_h_
00003 #define SimilarityMetric_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <vnl/vnl_double_3x3.h>
00026 #include <vgl/vgl_fwd.h>
00027 #include <mvl/ImageMetric.h>
00028 #include <vcl_iosfwd.h>
00029 class Image;
00030
00031 class SimilarityMetric : public ImageMetric
00032 {
00033
00034 double centre_x_;
00035 double centre_y_;
00036 double inv_scale_;
00037 double scale_;
00038
00039 vnl_double_3x3 cond_matrix;
00040 vnl_double_3x3 inv_cond_matrix;
00041
00042 public:
00043
00044
00045 SimilarityMetric();
00046 SimilarityMetric(int xsize, int ysize);
00047 SimilarityMetric(double cx, double cy, double scale);
00048
00049
00050
00051 ~SimilarityMetric();
00052
00053
00054 void set_from_rectangle(int xsize, int ysize);
00055 void set_center_and_scale(double cx, double cy, double scale);
00056 void scale_matrices(double s);
00057
00058
00059 virtual vgl_homg_point_2d<double> image_to_homg(vgl_point_2d<double> const&) const;
00060 virtual HomgPoint2D image_to_homg(const vnl_double_2&) const;
00061 virtual HomgPoint2D image_to_homg(double x, double y) const;
00062
00063 virtual vgl_point_2d<double> homg_to_image(vgl_homg_point_2d<double> const&) const;
00064 virtual vnl_double_2 homg_to_image(const HomgPoint2D&) const;
00065
00066 virtual HomgPoint2D imagehomg_to_homg(const HomgPoint2D&) const;
00067 virtual HomgPoint2D homg_to_imagehomg(const HomgPoint2D&) const;
00068 virtual vgl_homg_point_2d<double> imagehomg_to_homg(vgl_homg_point_2d<double> const&) const;
00069 virtual vgl_homg_point_2d<double> homg_to_imagehomg(vgl_homg_point_2d<double> const&) const;
00070
00071 virtual double perp_dist_squared(HomgPoint2D const& p, HomgLine2D const& l) const;
00072 virtual double perp_dist_squared(vgl_homg_point_2d<double> const&,
00073 vgl_homg_line_2d<double> const&) const;
00074 virtual double distance_squared(const vgl_homg_point_2d<double>&, const vgl_homg_point_2d<double>&) const;
00075 virtual double distance_squared(vgl_line_segment_2d<double> const& segment,
00076 vgl_homg_line_2d<double> const& line) const;
00077 virtual double distance_squared(HomgPoint2D const&, HomgPoint2D const&) const;
00078 virtual double distance_squared(HomgLineSeg2D const& segment, HomgLine2D const& line) const;
00079
00080 virtual bool is_linear() const { return true; }
00081 virtual vnl_double_3x3 get_C() const { return cond_matrix; }
00082 virtual vnl_double_3x3 get_C_inverse() const { return inv_cond_matrix; }
00083
00084 virtual bool can_invert_distance() const;
00085 virtual double image_to_homg_distance(double image_distance) const;
00086 virtual double homg_to_image_distance(double image_distance) const;
00087
00088
00089
00090
00091 vcl_ostream& print(vcl_ostream&) const;
00092 void print() const;
00093 void print(char* msg) const;
00094
00095 private:
00096
00097 void make_matrices();
00098 };
00099
00100 #endif // SimilarityMetric_h_