CVD 0.8
Public Member Functions | Public Attributes | Related Functions
CVD::ImageRef Class Reference

An (x,y) image co-ordinate. More...

#include <image_ref.h>

List of all members.

Public Member Functions

 ImageRef ()
 ImageRef (int xp, int yp)
 ImageRef (std::istream &is)
bool next (const ImageRef &max)
bool prev (const ImageRef &max)
bool next (const ImageRef &min, const ImageRef &max)
bool prev (const ImageRef &min, const ImageRef &max)
void home ()
void end (const ImageRef &size)
ImageRefoperator= (const ImageRef &ref)
bool operator== (const ImageRef &ref) const
bool operator!= (const ImageRef &ref) const
ImageRef operator- () const
ImageRefoperator*= (const double scale)
ImageRefoperator/= (const double scale)
ImageRefoperator+= (const ImageRef rhs)
ImageRefoperator-= (const ImageRef rhs)
ImageRef operator* (const double scale) const
ImageRef operator/ (const double scale) const
ImageRef operator+ (const ImageRef rhs) const
ImageRef operator- (const ImageRef rhs) const
ImageRefoperator<<= (int i)
ImageRefoperator>>= (int i)
ImageRef operator>> (int i) const
ImageRef operator<< (int i) const
bool operator< (const ImageRef &other) const
bool operator> (const ImageRef &other) const
unsigned int mag_squared () const
int area () const
ImageRef dot_times (const ImageRef &ref) const
int & operator[] (int i)
int operator[] (int i) const
ImageRef shiftl (int i) const
ImageRef shiftr (int i) const

Public Attributes

int x
int y

Related Functions

(Note that these are not member functions.)

ImageRef operator* (const int scale, const ImageRef &ref)
std::ostream & operator<< (std::ostream &os, const ImageRef &ref)
std::istream & operator>> (std::istream &is, ImageRef &ref)
const ImageRef ImageRef_zero (0, 0)

Detailed Description

An (x,y) image co-ordinate.

Definition at line 47 of file image_ref.h.


Constructor & Destructor Documentation

CVD::ImageRef::ImageRef ( int  xp,
int  yp 
) [inline]

Construct an ImageRef.

Parameters:
xpThe x co-ordinate
ypThe y co-ordinate

Definition at line 27 of file image_ref.h.

CVD::ImageRef::ImageRef ( std::istream &  is) [inline]

Construct an ImageRef from a stream.

Parameters:
isThe stream to read

Definition at line 31 of file image_ref.h.


Member Function Documentation

bool CVD::ImageRef::next ( const ImageRef max) [inline]

Step to the next co-ordinate in the image (in horizontal scanline order).

Successive calls to this function will work along each row of the image. If the next co-ordinate is off the end of the image, it returns false.

Parameters:
maxThe size of the image

Definition at line 44 of file image_ref.h.

Referenced by CVD::combineImages().

bool CVD::ImageRef::prev ( const ImageRef max) [inline]

Step to the previous co-ordinate in the image (in horizontal scanline order).

Successive calls to this function will work backwards along each row of the image. If the next co-ordinate is off the start of the image, it returns false.

Parameters:
maxThe size of the image

Definition at line 54 of file image_ref.h.

bool CVD::ImageRef::next ( const ImageRef min,
const ImageRef max 
) [inline]

Step to the next co-ordinate in the image (in horizontal scanline order), for pixels within a rectangular window Successive calls to this function will work backwards along each row of the image.

If the next co-ordinate is off the start of the image, it returns false.

Parameters:
minThe minimum (x,y) co-ordinates in the window
maxThe minimum (x,y) co-ordinates in the window

Definition at line 49 of file image_ref.h.

bool CVD::ImageRef::prev ( const ImageRef min,
const ImageRef max 
) [inline]

Step to the previous co-ordinate in the image (in horizontal scanline order), for pixels within a rectangule window Successive calls to this function will work backwards along each row of the image.

If the next co-ordinate is off the start of the image, it returns false.

Parameters:
minThe minimum (x,y) co-ordinates in the window
maxThe minimum (x,y) co-ordinates in the window

Definition at line 59 of file image_ref.h.

void CVD::ImageRef::end ( const ImageRef size) [inline]

Resets the ImageRef to the maximum co-ordinate in the image i.e.

(size.x - 1, size.y - 1)

Parameters:
sizeThe size of the image

Definition at line 69 of file image_ref.h.

ImageRef & CVD::ImageRef::operator= ( const ImageRef ref) [inline]

Assigment.

Parameters:
refThe co-ordinate to copy

Definition at line 75 of file image_ref.h.

bool CVD::ImageRef::operator== ( const ImageRef ref) const [inline]

Logical equals.

Parameters:
refThe co-ordinate to compare with

Definition at line 82 of file image_ref.h.

bool CVD::ImageRef::operator!= ( const ImageRef ref) const [inline]

Logical not equals.

Parameters:
refThe co-ordinate to compare with

Definition at line 87 of file image_ref.h.

ImageRef & CVD::ImageRef::operator*= ( const double  scale) [inline]

Multiply both x and y co-ordinates by a scalar.

Parameters:
scaleThe multiplier

Definition at line 98 of file image_ref.h.

ImageRef & CVD::ImageRef::operator/= ( const double  scale) [inline]

Divide both x and y co-ordinates by a scalar.

Parameters:
scaleThe factor

Definition at line 105 of file image_ref.h.

ImageRef & CVD::ImageRef::operator+= ( const ImageRef  rhs) [inline]

Add an offset to the co-ordinate.

Parameters:
rhsThe offset

Definition at line 112 of file image_ref.h.

ImageRef & CVD::ImageRef::operator-= ( const ImageRef  rhs) [inline]

Subtract an offset from the co-ordinate.

Parameters:
rhsThe offset

Definition at line 119 of file image_ref.h.

ImageRef CVD::ImageRef::operator* ( const double  scale) const [inline]

Multiply both x and y co-ordinates by a scalar.

Parameters:
scaleThe multiplier

Definition at line 126 of file image_ref.h.

ImageRef CVD::ImageRef::operator/ ( const double  scale) const [inline]

Divide both x and y co-ordinates by a scalar.

Parameters:
scaleThe factor

Definition at line 132 of file image_ref.h.

ImageRef CVD::ImageRef::operator+ ( const ImageRef  rhs) const [inline]

Add an offset to the co-ordinate.

Parameters:
rhsThe offset

Definition at line 138 of file image_ref.h.

ImageRef CVD::ImageRef::operator- ( const ImageRef  rhs) const [inline]

Subtract an offset from the co-ordinate.

Parameters:
rhsThe offset

Definition at line 144 of file image_ref.h.

ImageRef & CVD::ImageRef::operator<<= ( int  i) [inline]

Bitwise left-shift operator.

Parameters:
iThe amount to shift

Definition at line 150 of file image_ref.h.

ImageRef & CVD::ImageRef::operator>>= ( int  i) [inline]

Bitwise right-shift operator.

Parameters:
iThe amount to shift

Definition at line 157 of file image_ref.h.

ImageRef CVD::ImageRef::operator>> ( int  i) const [inline]

Bitwise right-shift operator.

Parameters:
iThe amount to shift

Definition at line 185 of file image_ref.h.

ImageRef CVD::ImageRef::operator<< ( int  i) const [inline]

Bitwise left-shift operator.

Parameters:
iThe amount to shift

Definition at line 180 of file image_ref.h.

bool CVD::ImageRef::operator< ( const ImageRef other) const [inline]

An ImageRef is less than another ImageRef if it is earlier in the standard horizontal scan-line order, i.e.

has a smaller y-co-ordinate or the same y-co-ordinate but a smaller x-co-ordinate. An ordering of ImageRefs is needed to allow them to be used in STL for sets, maps, multisets, multimaps etc.

Definition at line 196 of file image_ref.h.

bool CVD::ImageRef::operator> ( const ImageRef other) const [inline]

An ImageRef is greater than another ImageRef if it is earlier in the standard horizontal scan-line order, i.e.

has a smaller y-co-ordinate or the same y-co-ordinate but a smaller x-co-ordinate.

Definition at line 201 of file image_ref.h.

ImageRef CVD::ImageRef::shiftl ( int  i) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 164 of file image_ref.h.

ImageRef CVD::ImageRef::shiftr ( int  i) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 172 of file image_ref.h.


Friends And Related Function Documentation

ImageRef operator* ( const int  scale,
const ImageRef ref 
) [related]

Left-multiply an ImageRef by a scalar.

Mutiplies both x and y.

Parameters:
scaleThe multiplier
refThe ImageRef to scale

Definition at line 191 of file image_ref.h.

std::ostream & operator<< ( std::ostream &  os,
const ImageRef ref 
) [related]

Write an ImageRef to a stream in the format "[x y]".

Parameters:
osThe stream
refThe co-ordinate

Definition at line 205 of file image_ref.h.

std::istream & operator>> ( std::istream &  is,
ImageRef ref 
) [related]

Read an ImageRef from a stream.

Any format with two successive numbers will work

Definition at line 212 of file image_ref.h.

const ImageRef ImageRef_zero ( ,
 
) [related]

A zero ImageRef.


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