Public Member Functions | Static Public Member Functions | Protected Attributes | Friends
HomgNorm2D Class Reference

#include <HomgNorm2D.h>

Inheritance diagram for HomgNorm2D:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 HomgNorm2D (int n, bool unit_omega=true)
 Construct a HomgNorm2D that will hold n normalized points.
 HomgNorm2D (const vcl_vector< HomgPoint2D > &points, bool unit_omega=true)
 Construct a HomgNorm2D from an array of homogeneous points.
 HomgNorm2D (vcl_vector< vgl_homg_point_2d< double > > const &points, bool unit_omega=true)
 ~HomgNorm2D ()
 Destructor.
void normalize (const vcl_vector< HomgPoint2D > &points)
 Perform the normalization.
void normalize (vcl_vector< vgl_homg_point_2d< double > > const &points)
 Put the cog at the origin.
bool was_coincident (void) const
void set (const vcl_vector< HomgPoint2D > &points)
void set (vcl_vector< vgl_homg_point_2d< double > > const &points)
HomgPoint2D apply_normalization (const HomgPoint2D &p)
 Apply the normalization to the given point.
vgl_homg_point_2d< double > apply_normalization (vgl_homg_point_2d< double > const &p)
HomgPoint2D apply_denormalization (const HomgPoint2D &p)
 Apply the inverse normalization to the given point.
vgl_homg_point_2d< double > apply_denormalization (vgl_homg_point_2d< double > const &p)
vcl_vector< HomgPoint2D > & get_normalized_points ()
 Return the array of normalized points.
vcl_vector< vgl_homg_point_2d
< double > > 
normalized_points ()
bool points_have_unit_omega () const
 Have the points been scaled so their third components are one?.
HomgPoint2Doperator[] (int i)
 Return the i'th normalized point.
HomgPoint2Dget (int i)
 Return the i'th normalized point.
void set_from_rectangle (int xsize, int ysize)
 Set transform to "(x,y) -> (x - xsize/2, y - ysize/2) / ((xsize+ysize)/2)".
void set_center_and_scale (double cx, double cy, double scale)
 Set transform to "(x,y) -> (x - cx, y - cy) * scale".
void scale_matrices (double s)
 Multiply all components of the transform matrix by "s".
virtual vgl_homg_point_2d< double > image_to_homg (vgl_point_2d< double > const &) const
 Convert 2D image point $(x,y)$ to homogeneous coordinates.
virtual HomgPoint2D image_to_homg (const vnl_double_2 &) const
 Condition the 2D point p.
virtual HomgPoint2D image_to_homg (double x, double y) const
 Convert 2D point $(x,y)$ to homogeneous coordinates.
virtual vgl_point_2d< double > homg_to_image (vgl_homg_point_2d< double > const &) const
 Convert conditioned point p to image coordinates.
virtual vnl_double_2 homg_to_image (const HomgPoint2D &) const
 Decondition homogeneous point.
virtual HomgPoint2D imagehomg_to_homg (const HomgPoint2D &) const
virtual vgl_homg_point_2d< double > imagehomg_to_homg (vgl_homg_point_2d< double > const &) const
 Transform homogeneous point in image coordinates to conditioned coordinates.
virtual HomgPoint2D homg_to_imagehomg (const HomgPoint2D &) const
 Transform homogeneous point to image coordinates, leaving it in homogeneous form.
virtual vgl_homg_point_2d< double > homg_to_imagehomg (vgl_homg_point_2d< double > const &) const
 Transform homogeneous point to image coordinates, leaving it in homogeneous form.
virtual double perp_dist_squared (HomgPoint2D const &p, HomgLine2D const &l) const
virtual double perp_dist_squared (vgl_homg_point_2d< double > const &, vgl_homg_line_2d< double > const &) const
 Compute perpendicular distance (in image coordinates) from point to line (supplied in conditioned coordinates).
virtual double distance_squared (const vgl_homg_point_2d< double > &, const vgl_homg_point_2d< double > &) const
 Compute distance (in image coordinates) between points supplied in conditioned coordinates.
virtual double distance_squared (vgl_line_segment_2d< double > const &segment, vgl_homg_line_2d< double > const &line) const
 Get distance between a line segment and an infinite line.
virtual double distance_squared (HomgPoint2D const &, HomgPoint2D const &) const
 Compute distance (in image coordinates) between points supplied in conditioned coordinates.
virtual double distance_squared (HomgLineSeg2D const &segment, HomgLine2D const &line) const
 Get distance between a line segment and an infinite line.
virtual bool is_linear () const
 Return true if the action of the conditioner can be represented as a planar homography.
virtual vnl_double_3x3 get_C () const
 Return conditioning matrix C that converts homogeneous image points to homogeneous conditioned points.
virtual vnl_double_3x3 get_C_inverse () const
 Return conditioning matrix C that converts homogeneous conditioned points to image coordinates.
virtual bool can_invert_distance () const
 Return true if the invert_distance function makes sense.
virtual double image_to_homg_distance (double image_distance) const
 Convert a distance in image coordinates to one in conditioned coordinates.
virtual double homg_to_image_distance (double image_distance) const
 Convert a distance in image coordinates to one in conditioned coordinates.
vcl_ostream & print (vcl_ostream &) const
 One line printout.
void print () const
void print (char *msg) const
 One line printout.
virtual vgl_homg_line_2d< double > homg_to_image_line (vgl_homg_line_2d< double > const &) const
 Convert homogeneous line in conditioned coordinates to one in image coordinates.
virtual HomgLine2D homg_to_image_line (const HomgLine2D &) const
virtual vgl_homg_line_2d< double > image_to_homg_line (vgl_homg_line_2d< double > const &) const
virtual HomgLine2D image_to_homg_line (const HomgLine2D &) const
virtual HomgLineSeg2D image_to_homg_line (const HomgLineSeg2D &) const
virtual vgl_line_segment_2d
< double > 
image_to_homg_line (vgl_line_segment_2d< double > const &l) const
virtual HomgLineSeg2D homg_line_to_image (const HomgLineSeg2D &) const
virtual vgl_line_segment_2d
< double > 
homg_line_to_image (vgl_line_segment_2d< double > const &l) const
 Convert homogeneous line segment in conditioned coordinates to one in image coordinates.
virtual HomgPoint2D perp_projection (const HomgLine2D &l, const HomgPoint2D &p) const
virtual vgl_homg_point_2d< double > perp_projection (vgl_homg_line_2d< double > const &l, vgl_homg_point_2d< double > const &p) const
 Project point onto line.
virtual bool is_within_distance (const HomgPoint2D &, const HomgPoint2D &, double distance) const
virtual bool is_within_distance (vgl_homg_point_2d< double > const &, vgl_homg_point_2d< double > const &, double distance) const

Static Public Member Functions

static FMatrix decondition (const FMatrix &F, const ImageMetric *c1, const ImageMetric *c2)

Protected Attributes

vcl_vector< HomgPoint2Dnormalized_
bool unit_omega_
bool was_coincident_

Friends

vcl_ostream & operator<< (vcl_ostream &o, const ImageMetric &m)

Detailed Description

Definition at line 32 of file HomgNorm2D.h.


Constructor & Destructor Documentation

HomgNorm2D::HomgNorm2D ( int  n,
bool  unit_omega = true 
) [inline]

Construct a HomgNorm2D that will hold n normalized points.

Definition at line 38 of file HomgNorm2D.h.

HomgNorm2D::HomgNorm2D ( const vcl_vector< HomgPoint2D > &  points,
bool  unit_omega = true 
)

Construct a HomgNorm2D from an array of homogeneous points.

The points will be normalized as described above and the results stored in this class. If the optional parameter unit_omega is set to false, then the points will not be scaled to ensure that the homogeneous parameter is one.

Definition at line 22 of file HomgNorm2D.cxx.

HomgNorm2D::HomgNorm2D ( vcl_vector< vgl_homg_point_2d< double > > const &  points,
bool  unit_omega = true 
)

Definition at line 15 of file HomgNorm2D.cxx.

HomgNorm2D::~HomgNorm2D ( )

Destructor.

Definition at line 30 of file HomgNorm2D.cxx.


Member Function Documentation

HomgPoint2D HomgNorm2D::apply_denormalization ( const HomgPoint2D p) [inline]

Apply the inverse normalization to the given point.

Definition at line 69 of file HomgNorm2D.h.

vgl_homg_point_2d<double> HomgNorm2D::apply_denormalization ( vgl_homg_point_2d< double > const &  p) [inline]

Definition at line 70 of file HomgNorm2D.h.

HomgPoint2D HomgNorm2D::apply_normalization ( const HomgPoint2D p) [inline]

Apply the normalization to the given point.

Definition at line 65 of file HomgNorm2D.h.

vgl_homg_point_2d<double> HomgNorm2D::apply_normalization ( vgl_homg_point_2d< double > const &  p) [inline]

Definition at line 66 of file HomgNorm2D.h.

bool SimilarityMetric::can_invert_distance ( ) const [virtual, inherited]

Return true if the invert_distance function makes sense.

Reimplemented from ImageMetric.

Definition at line 284 of file SimilarityMetric.cxx.

FMatrix ImageMetric::decondition ( const FMatrix F,
const ImageMetric c1,
const ImageMetric c2 
) [static, inherited]

Definition at line 308 of file ImageMetric.cxx.

double SimilarityMetric::distance_squared ( const vgl_homg_point_2d< double > &  p1,
const vgl_homg_point_2d< double > &  p2 
) const [virtual, inherited]

Compute distance (in image coordinates) between points supplied in conditioned coordinates.

Reimplemented from ImageMetric.

Definition at line 194 of file SimilarityMetric.cxx.

double SimilarityMetric::distance_squared ( vgl_line_segment_2d< double > const &  segment,
vgl_homg_line_2d< double > const &  line 
) const [virtual, inherited]

Get distance between a line segment and an infinite line.

The metric used is the maximum of the two endpoint perp distances.

Reimplemented from ImageMetric.

Definition at line 220 of file SimilarityMetric.cxx.

double SimilarityMetric::distance_squared ( HomgPoint2D const &  p1,
HomgPoint2D const &  p2 
) const [virtual, inherited]

Compute distance (in image coordinates) between points supplied in conditioned coordinates.

Reimplemented from ImageMetric.

Definition at line 206 of file SimilarityMetric.cxx.

double SimilarityMetric::distance_squared ( HomgLineSeg2D const &  segment,
HomgLine2D const &  line 
) const [virtual, inherited]

Get distance between a line segment and an infinite line.

The metric used is the maximum of the two endpoint perp distances.

Reimplemented from ImageMetric.

Definition at line 228 of file SimilarityMetric.cxx.

HomgPoint2D& HomgNorm2D::get ( int  i) [inline]

Return the i'th normalized point.

Definition at line 85 of file HomgNorm2D.h.

virtual vnl_double_3x3 SimilarityMetric::get_C ( ) const [inline, virtual, inherited]

Return conditioning matrix C that converts homogeneous image points to homogeneous conditioned points.

If the ImageMetric used is nonlinear, then we'll have to make other arrangements...

Reimplemented from ImageMetric.

Definition at line 80 of file SimilarityMetric.h.

virtual vnl_double_3x3 SimilarityMetric::get_C_inverse ( ) const [inline, virtual, inherited]

Return conditioning matrix C that converts homogeneous conditioned points to image coordinates.

Reimplemented from ImageMetric.

Definition at line 81 of file SimilarityMetric.h.

vcl_vector<HomgPoint2D>& HomgNorm2D::get_normalized_points ( ) [inline]

Return the array of normalized points.

Definition at line 75 of file HomgNorm2D.h.

HomgLineSeg2D ImageMetric::homg_line_to_image ( const HomgLineSeg2D l) const [virtual, inherited]

Definition at line 155 of file ImageMetric.cxx.

vgl_line_segment_2d< double > ImageMetric::homg_line_to_image ( vgl_line_segment_2d< double > const &  l) const [virtual, inherited]

Convert homogeneous line segment in conditioned coordinates to one in image coordinates.

Definition at line 147 of file ImageMetric.cxx.

vgl_point_2d< double > SimilarityMetric::homg_to_image ( vgl_homg_point_2d< double > const &  p) const [virtual, inherited]

Convert conditioned point p to image coordinates.

Reimplemented from ImageMetric.

Definition at line 146 of file SimilarityMetric.cxx.

vnl_double_2 SimilarityMetric::homg_to_image ( const HomgPoint2D p) const [virtual, inherited]

Decondition homogeneous point.

Reimplemented from ImageMetric.

Definition at line 152 of file SimilarityMetric.cxx.

double SimilarityMetric::homg_to_image_distance ( double  image_distance) const [virtual, inherited]

Convert a distance in image coordinates to one in conditioned coordinates.

This is only possible for similarity transformations, but where it does make sense it can mean significant increases in speed.

Reimplemented from ImageMetric.

Definition at line 294 of file SimilarityMetric.cxx.

vgl_homg_line_2d< double > ImageMetric::homg_to_image_line ( vgl_homg_line_2d< double > const &  l) const [virtual, inherited]

Convert homogeneous line in conditioned coordinates to one in image coordinates.

Definition at line 93 of file ImageMetric.cxx.

HomgLine2D ImageMetric::homg_to_image_line ( const HomgLine2D l) const [virtual, inherited]

Definition at line 106 of file ImageMetric.cxx.

HomgPoint2D SimilarityMetric::homg_to_imagehomg ( const HomgPoint2D x) const [virtual, inherited]

Transform homogeneous point to image coordinates, leaving it in homogeneous form.

Reimplemented from ImageMetric.

Definition at line 175 of file SimilarityMetric.cxx.

vgl_homg_point_2d< double > SimilarityMetric::homg_to_imagehomg ( vgl_homg_point_2d< double > const &  x) const [virtual, inherited]

Transform homogeneous point to image coordinates, leaving it in homogeneous form.

Reimplemented from ImageMetric.

Definition at line 169 of file SimilarityMetric.cxx.

vgl_homg_point_2d< double > SimilarityMetric::image_to_homg ( vgl_point_2d< double > const &  p) const [virtual, inherited]

Convert 2D image point $(x,y)$ to homogeneous coordinates.

The precise transformation is $(x,y) \rightarrow (x - cx, y - cy, f)$

Reimplemented from ImageMetric.

Definition at line 124 of file SimilarityMetric.cxx.

HomgPoint2D SimilarityMetric::image_to_homg ( const vnl_double_2 &  p) const [virtual, inherited]

Condition the 2D point p.

Reimplemented from ImageMetric.

Definition at line 163 of file SimilarityMetric.cxx.

HomgPoint2D SimilarityMetric::image_to_homg ( double  x,
double  y 
) const [virtual, inherited]

Convert 2D point $(x,y)$ to homogeneous coordinates.

The precise transformation is $(x,y) \rightarrow (x - cx, y - cy, f)$

Reimplemented from ImageMetric.

Definition at line 136 of file SimilarityMetric.cxx.

double SimilarityMetric::image_to_homg_distance ( double  image_distance) const [virtual, inherited]

Convert a distance in image coordinates to one in conditioned coordinates.

This is only possible for similarity transformations, but where it does make sense it can mean significant increases in speed.

Reimplemented from ImageMetric.

Definition at line 289 of file SimilarityMetric.cxx.

vgl_homg_line_2d< double > ImageMetric::image_to_homg_line ( vgl_homg_line_2d< double > const &  l) const [virtual, inherited]

Definition at line 119 of file ImageMetric.cxx.

HomgLine2D ImageMetric::image_to_homg_line ( const HomgLine2D l) const [virtual, inherited]

Definition at line 132 of file ImageMetric.cxx.

HomgLineSeg2D ImageMetric::image_to_homg_line ( const HomgLineSeg2D l) const [virtual, inherited]

Definition at line 170 of file ImageMetric.cxx.

vgl_line_segment_2d< double > ImageMetric::image_to_homg_line ( vgl_line_segment_2d< double > const &  l) const [virtual, inherited]

Definition at line 163 of file ImageMetric.cxx.

HomgPoint2D SimilarityMetric::imagehomg_to_homg ( const HomgPoint2D x) const [virtual, inherited]

Reimplemented from ImageMetric.

Definition at line 187 of file SimilarityMetric.cxx.

vgl_homg_point_2d< double > SimilarityMetric::imagehomg_to_homg ( vgl_homg_point_2d< double > const &  x) const [virtual, inherited]

Transform homogeneous point in image coordinates to conditioned coordinates.

Reimplemented from ImageMetric.

Definition at line 182 of file SimilarityMetric.cxx.

virtual bool SimilarityMetric::is_linear ( ) const [inline, virtual, inherited]

Return true if the action of the conditioner can be represented as a planar homography.

Reimplemented from ImageMetric.

Definition at line 79 of file SimilarityMetric.h.

bool ImageMetric::is_within_distance ( const HomgPoint2D p1,
const HomgPoint2D p2,
double  distance 
) const [virtual, inherited]

Definition at line 250 of file ImageMetric.cxx.

bool ImageMetric::is_within_distance ( vgl_homg_point_2d< double > const &  p1,
vgl_homg_point_2d< double > const &  p2,
double  distance 
) const [virtual, inherited]

Definition at line 243 of file ImageMetric.cxx.

void HomgNorm2D::normalize ( const vcl_vector< HomgPoint2D > &  points)

Perform the normalization.

Definition at line 103 of file HomgNorm2D.cxx.

void HomgNorm2D::normalize ( vcl_vector< vgl_homg_point_2d< double > > const &  points)

Put the cog at the origin.

Scale x,y so that mean (x^2 + y^2) = 2 when z = 1.

Definition at line 42 of file HomgNorm2D.cxx.

vcl_vector<vgl_homg_point_2d<double> > HomgNorm2D::normalized_points ( )
HomgPoint2D& HomgNorm2D::operator[] ( int  i) [inline]

Return the i'th normalized point.

Definition at line 82 of file HomgNorm2D.h.

double SimilarityMetric::perp_dist_squared ( HomgPoint2D const &  p,
HomgLine2D const &  l 
) const [virtual, inherited]

Reimplemented from ImageMetric.

Definition at line 253 of file SimilarityMetric.cxx.

double SimilarityMetric::perp_dist_squared ( vgl_homg_point_2d< double > const &  p,
vgl_homg_line_2d< double > const &  l 
) const [virtual, inherited]

Compute perpendicular distance (in image coordinates) from point to line (supplied in conditioned coordinates).

Reimplemented from ImageMetric.

Definition at line 235 of file SimilarityMetric.cxx.

HomgPoint2D ImageMetric::perp_projection ( const HomgLine2D l,
const HomgPoint2D p 
) const [virtual, inherited]

Definition at line 201 of file ImageMetric.cxx.

vgl_homg_point_2d< double > ImageMetric::perp_projection ( vgl_homg_line_2d< double > const &  l,
vgl_homg_point_2d< double > const &  p 
) const [virtual, inherited]

Project point onto line.

Definition at line 192 of file ImageMetric.cxx.

bool HomgNorm2D::points_have_unit_omega ( ) const [inline]

Have the points been scaled so their third components are one?.

Definition at line 79 of file HomgNorm2D.h.

vcl_ostream & SimilarityMetric::print ( vcl_ostream &  s) const [virtual, inherited]

One line printout.

Reimplemented from ImageMetric.

Definition at line 115 of file SimilarityMetric.cxx.

void SimilarityMetric::print ( ) const [inherited]
void SimilarityMetric::print ( char *  msg) const [inherited]

One line printout.

Definition at line 109 of file SimilarityMetric.cxx.

void SimilarityMetric::scale_matrices ( double  s) [inherited]

Multiply all components of the transform matrix by "s".

This routine is likely to be used only by programs which need special control over the exact form of their output.

Definition at line 278 of file SimilarityMetric.cxx.

void HomgNorm2D::set ( const vcl_vector< HomgPoint2D > &  points) [inline]

Definition at line 59 of file HomgNorm2D.h.

void HomgNorm2D::set ( vcl_vector< vgl_homg_point_2d< double > > const &  points) [inline]

Definition at line 60 of file HomgNorm2D.h.

void SimilarityMetric::set_center_and_scale ( double  cx,
double  cy,
double  scale 
) [inherited]

Set transform to "(x,y) -> (x - cx, y - cy) * scale".

For example, (640 / 2, 480 / 2, 2.0 / (640 + 480))

Definition at line 66 of file SimilarityMetric.cxx.

void SimilarityMetric::set_from_rectangle ( int  xsize,
int  ysize 
) [inherited]

Set transform to "(x,y) -> (x - xsize/2, y - ysize/2) / ((xsize+ysize)/2)".

Definition at line 54 of file SimilarityMetric.cxx.

bool HomgNorm2D::was_coincident ( void  ) const [inline]

Definition at line 57 of file HomgNorm2D.h.


Friends And Related Function Documentation

vcl_ostream& operator<< ( vcl_ostream &  o,
const ImageMetric m 
) [friend, inherited]

Definition at line 109 of file ImageMetric.h.


Member Data Documentation

vcl_vector<HomgPoint2D> HomgNorm2D::normalized_ [protected]

Definition at line 89 of file HomgNorm2D.h.

bool HomgNorm2D::unit_omega_ [protected]

Definition at line 90 of file HomgNorm2D.h.

bool HomgNorm2D::was_coincident_ [protected]

Definition at line 91 of file HomgNorm2D.h.


The documentation for this class was generated from the following files: