VisualObject Class Reference

Describes name and attributes of a visual object. More...

#include <SIFT/VisualObject.H>

Inheritance diagram for VisualObject:
Inheritance graph
[legend]
Collaboration diagram for VisualObject:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Constructor, assigment and destructor

 VisualObject (const std::string &name="NULL", const std::string &imagefname="NULL", const Image< PixRGB< byte > > &image=Image< PixRGB< byte > >(), const Point2D< int > &salpt=Point2D< int >(-1,-1), const std::vector< float > &preattfeatures=std::vector< float >(), const std::vector< rutz::shared_ptr< Keypoint > > &keypoints=std::vector< rutz::shared_ptr< Keypoint > >(), const bool useColor=false, bool computeKP=true)
 Constructor assuming precomputed keypoints.
void computeKeypoints ()
 VisualObject (const VisualObject &vo)
 Copy constructor.
 ~VisualObject ()
 Destructor.
VisualObjectoperator= (const VisualObject &vo)
 Assignment.
Access functions

const std::stringgetName () const
 name getter
void setName (const std::string &name)
 change the name, e.g., after we have recognized the object
const std::stringgetImageFname () const
 image filename getter
void setImageFname (const std::string &fname)
 change the image file name, e.g., after we have recognized the object
void setObjectSize (const Dims size)
 change the size of the object
void deleteImageFile () const
 delete the image file from disk
const Image< PixRGB< byte > > & getImage ()
 image getter
const Dims getObjectSize () const
 get the object dims
const Point2D< int > & getSalPoint () const
 get the salient point location
const std::vector< float > & getFeatures () const
 get all preattentive features
uint numFeatures () const
 get number of pre-attentive features
float getFeature (const uint index) const
 get a given pre-attentive feature
const std::vector
< rutz::shared_ptr< Keypoint > > & 
getKeypoints () const
 get all SIFT keypoints
uint numKeypoints () const
 get number of SIFT keypoints
const rutz::shared_ptr
< Keypoint > & 
getKeypoint (const uint index) const
 get a given SIFT keypoint
void loadImage ()
 load the visual object image without returning it
Compute functions

void sortKeypoints ()
 Sort our Keypoints in ascending order of their DoG magnitude.
double getFeatureDistSq (const rutz::shared_ptr< VisualObject > &obj) const
 get squared distance between our and obj's pre-attentive features
Image< PixRGB< byte > > getKeypointImage (const float scale=2.0F, const float vmag=5.0F, const PixRGB< byte > col=PixRGB< byte >(255, 0, 0))
 Get an image that shows our SIFT keypoints.
Image< PixRGB< byte > > getKeypointImage2 (const float scale=2.0F, const float vmag=5.0F, const PixRGB< byte > col=PixRGB< byte >(255, 0, 0))
 same as getKeypointImage with scale displayed as well
Image< PixRGB< byte > > getSalAndKeypointImage (const float scale=2.0F, const float vmag=5.0F, const PixRGB< byte > col=PixRGB< byte >(255, 0, 0))
 same as getKeypointImage except + salient point

Static Public Member Functions

static void createVisualObject (std::istream &is, VisualObject &v, bool loadImage=true)

Protected Attributes

std::string itsName
std::string itsImageFname
Image< PixRGB< byte > > itsImage
std::vector< rutz::shared_ptr
< Keypoint > > 
itsKeypoints
Point2D< int > itsSalPoint
std::vector< float > itsFeatures
bool itsIsSorted
bool itsUseColor
bool itsImageLoaded
Dims itsObjectSize

Friends

std::istream & operator>> (std::istream &is, VisualObject &v)
 Load a VisualObject from an istream.
std::ostream & operator<< (std::ostream &os, const VisualObject &v)
 Save a VisualObject to an ostream.

Detailed Description

Describes name and attributes of a visual object.

A VisualObject is a visual view of a given real-world object. As such, it is described by a name, an Image representing the view, and possibly a preattentive feature vector (as obtained, for example, from VisualCortex::getFeatures() ), and a list of SIFT Keypoint objects.

Definition at line 58 of file VisualObject.H.


Constructor & Destructor Documentation

VisualObject::VisualObject ( const std::string name = "NULL",
const std::string imagefname = "NULL",
const Image< PixRGB< byte > > &  image = ImagePixRGB<byte> >(),
const Point2D< int > &  salpt = Point2D<int>(-1,-1),
const std::vector< float > &  preattfeatures = std::vector<float>(),
const std::vector< rutz::shared_ptr< Keypoint > > &  keypoints = std::vectorrutz::shared_ptr<Keypoint> >(),
const bool  useColor = false,
bool  computeKP = true 
)

Constructor assuming precomputed keypoints.

Parameters:
name the name of the object.
imagefname the filename to store our image into; see operator<< and operator>> for details on how this will be used.
image an image of the object. Also see operator<< and operator>> for details.
salpt the salient point location of the object.
preattfeatures preattentive features, as obtained, for example, from VisualCortex::getFeatures().
keypoints a vector of SIFT Keypoint descriptors. If this is empty, then a ScaleSpace will be built from the image and the SIFT keypoints will be extracted from it.

Definition at line 98 of file VisualObject.C.

References computeKeypoints(), Image< T >::getDims(), and image.

VisualObject::VisualObject ( const VisualObject vo  ) 

Copy constructor.

Definition at line 202 of file VisualObject.C.

References Image< T >::freeMem(), and Image< T >::initialized().

VisualObject::~VisualObject (  ) 

Destructor.

Definition at line 212 of file VisualObject.C.


Member Function Documentation

void VisualObject::computeKeypoints (  ) 

this is for computing keypoints at a later time only compute if the image is initialized and keypoints vector is empty

Reimplemented in CUDAVisualObject.

Definition at line 117 of file VisualObject.C.

References CONV_BOUNDARY_CLEAN, decXY(), ScaleSpace::findKeypoints(), Image< T >::getHeight(), getRGBY(), ScaleSpace::getTwoSigmaImage(), Image< T >::getWidth(), Image< T >::initialized(), interpolate(), lum, sepFilter(), and sum().

Referenced by VisualObject().

void VisualObject::deleteImageFile (  )  const

delete the image file from disk

This is useful if you want to make sure that the current image will be saved, as by default operator<< will not overwrite the image file.

Definition at line 216 of file VisualObject.C.

References Raster::fileExists(), and RASFMT_PNG.

float VisualObject::getFeature ( const uint  index  )  const [inline]

get a given pre-attentive feature

Definition at line 283 of file VisualObject.H.

References ASSERT.

double VisualObject::getFeatureDistSq ( const rutz::shared_ptr< VisualObject > &  obj  )  const

get squared distance between our and obj's pre-attentive features

Definition at line 239 of file VisualObject.C.

References ASSERT.

const std::vector< float > & VisualObject::getFeatures (  )  const [inline]

get all preattentive features

Definition at line 277 of file VisualObject.H.

const Image< PixRGB< byte > > & VisualObject::getImage (  )  [inline]

image getter

Definition at line 250 of file VisualObject.H.

References Raster::ReadRGB().

Referenced by getKeypointImage(), and getKeypointImage2().

const std::string & VisualObject::getImageFname (  )  const [inline]

image filename getter

Definition at line 241 of file VisualObject.H.

const rutz::shared_ptr< Keypoint > & VisualObject::getKeypoint ( const uint  index  )  const [inline]

get a given SIFT keypoint

Definition at line 297 of file VisualObject.H.

References ASSERT.

Image< PixRGB< byte > > VisualObject::getKeypointImage ( const float  scale = 2.0F,
const float  vmag = 5.0F,
const PixRGB< byte col = PixRGB<byte>(255, 0, 0) 
)

Get an image that shows our SIFT keypoints.

This returns our internal image onto which our keypoints are drawn as little vectors.

Parameters:
scale optional scale factor to apply to the image, default is to zoom in by a factor 4, which makes the keypoints more visible.
vmag magnitute factor for the length of the scale vectors.
col color of the vectors.

Definition at line 357 of file VisualObject.C.

References drawDisk(), Image< T >::getHeight(), getImage(), Image< T >::getWidth(), image, and rescale().

Referenced by getSalAndKeypointImage().

Image< PixRGB< byte > > VisualObject::getKeypointImage2 ( const float  scale = 2.0F,
const float  vmag = 5.0F,
const PixRGB< byte col = PixRGB<byte>(255, 0, 0) 
)

same as getKeypointImage with scale displayed as well

Definition at line 389 of file VisualObject.C.

References drawCircle(), drawDisk(), Image< T >::getHeight(), getImage(), Image< T >::getWidth(), image, and rescale().

const std::vector< rutz::shared_ptr< Keypoint > > & VisualObject::getKeypoints (  )  const [inline]

get all SIFT keypoints

Definition at line 290 of file VisualObject.H.

const std::string & VisualObject::getName ( void   )  const [inline]

name getter

Definition at line 235 of file VisualObject.H.

const Dims VisualObject::getObjectSize (  )  const [inline]

get the object dims

Definition at line 269 of file VisualObject.H.

Image< PixRGB< byte > > VisualObject::getSalAndKeypointImage ( const float  scale = 2.0F,
const float  vmag = 5.0F,
const PixRGB< byte col = PixRGB<byte>(255, 0, 0) 
)

same as getKeypointImage except + salient point

Definition at line 424 of file VisualObject.C.

References drawDisk(), getKeypointImage(), Point2D< T >::i, and image.

const Point2D< int > & VisualObject::getSalPoint (  )  const [inline]

get the salient point location

Definition at line 274 of file VisualObject.H.

void VisualObject::loadImage (  )  [inline]

load the visual object image without returning it

Definition at line 260 of file VisualObject.H.

References Raster::ReadRGB().

uint VisualObject::numFeatures (  )  const [inline]

get number of pre-attentive features

Definition at line 280 of file VisualObject.H.

uint VisualObject::numKeypoints (  )  const [inline]

get number of SIFT keypoints

Definition at line 293 of file VisualObject.H.

VisualObject & VisualObject::operator= ( const VisualObject vo  ) 

Assignment.

Definition at line 224 of file VisualObject.C.

References Image< T >::freeMem(), and Image< T >::initialized().

void VisualObject::setImageFname ( const std::string fname  )  [inline]

change the image file name, e.g., after we have recognized the object

Definition at line 244 of file VisualObject.H.

void VisualObject::setName ( const std::string name  )  [inline]

change the name, e.g., after we have recognized the object

Definition at line 238 of file VisualObject.H.

void VisualObject::setObjectSize ( const Dims  size  )  [inline]

change the size of the object

Definition at line 247 of file VisualObject.H.

void VisualObject::sortKeypoints (  ) 

Sort our Keypoints in ascending order of their DoG magnitude.

We internally keep track of when we are sorted, so calling this multiple times will not impact performance.

Definition at line 258 of file VisualObject.C.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const VisualObject v 
) [friend]

Save a VisualObject to an ostream.

If our image file name is known also save the image, but only if there is not already a file by than name. You should delete the file first if you want to ensure that the image will be saved. You can use VisualObject::deleteImageFile() for that.

Definition at line 268 of file VisualObject.C.

std::istream& operator>> ( std::istream &  is,
VisualObject v 
) [friend]

Load a VisualObject from an istream.

Definition at line 293 of file VisualObject.C.


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:44:03 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3