PLearn 0.1
Public Member Functions | Protected Attributes
PLearn::RGBImagesVMatrix Class Reference

#include <RGBImage.h>

Inheritance diagram for PLearn::RGBImagesVMatrix:
Inheritance graph
[legend]
Collaboration diagram for PLearn::RGBImagesVMatrix:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RGBImagesVMatrix (RGBImageDB &images_db, const Vec &delta_row, const Vec &delta_col, bool append_class, real scale=1.0, real offset_=0.0)
virtual int width ()
virtual int length ()
virtual void reset ()
virtual void sample (Vec &samplevec)
virtual void seek (int position)
virtual int position ()
virtual bool firstSampleOfObject ()
virtual int nSamplesOfObject ()
virtual int nObjects ()

Protected Attributes

RGBImageVMatrix image_distr
RGBImageDBimages_db
int current_image
bool append_class
int length_
Vec pixelsAndClass
Vec pixels
Vec image_start
 starting "position" (re: position() method) for each image
int width_

Detailed Description

A collection of images that is traversed pixel by pixel in the fashion presribed by an RGBImageVMatrix. The images are traversed in order, and the correct class can optionally be appended as the last column.

Definition at line 274 of file RGBImage.h.


Constructor & Destructor Documentation

PLearn::RGBImagesVMatrix::RGBImagesVMatrix ( RGBImageDB images_db,
const Vec delta_row,
const Vec delta_col,
bool  append_class,
real  scale = 1.0,
real  offset_ = 0.0 
)

Definition at line 509 of file RGBImage.cc.

References append_class, PLearn::RGBImageDB::getImage(), i, image_distr, image_start, PLearn::RGBImageDB::imageIdAndClass, images_db, PLearn::TMat< T >::length(), PLearn::RGBImageVMatrix::length(), PLearn::TVec< T >::length(), length_, n, pixels, pixelsAndClass, PLearn::TVec< T >::resize(), PLearn::RGBImageVMatrix::setImage(), PLearn::TVec< T >::subVec(), PLearn::RGBImageVMatrix::width(), and width_.

  :image_distr(imagesdb.getImage((int)imagesdb.imageIdAndClass(0,0)),delta_row,delta_col,scale,offset_),
   images_db(imagesdb), current_image(0), append_class(appendclass),
   length_(0), image_start(imagesdb.imageIdAndClass.length()) 
{ 
  width_ = 3*(delta_row.length()+1);
  if(append_class)
    width_++;

  for (int i=0;i<images_db.imageIdAndClass.length();i++)
    {
      image_start[i] = length_;
      image_distr.setImage(images_db.getImage((int)imagesdb.imageIdAndClass(i,0)));
      length_ += image_distr.length();
    }
  if (append_class)
    {
      int n = image_distr.width();
      pixelsAndClass.resize(n+1);
      pixels = pixelsAndClass.subVec(0,n);
    }
}

Here is the call graph for this function:


Member Function Documentation

bool PLearn::RGBImagesVMatrix::firstSampleOfObject ( ) [virtual]

Definition at line 588 of file RGBImage.cc.

References PLearn::RGBImageVMatrix::first(), and image_distr.

{
  return image_distr.first();
}

Here is the call graph for this function:

int PLearn::RGBImagesVMatrix::length ( ) [virtual]

Definition at line 537 of file RGBImage.cc.

References length_.

{ return length_; }
int PLearn::RGBImagesVMatrix::nObjects ( ) [virtual]

Definition at line 599 of file RGBImage.cc.

References PLearn::RGBImageDB::imageIdAndClass, images_db, and PLearn::TMat< T >::length().

{
  return images_db.imageIdAndClass.length(); 
}

Here is the call graph for this function:

int PLearn::RGBImagesVMatrix::nSamplesOfObject ( ) [virtual]

Definition at line 593 of file RGBImage.cc.

References image_distr, and PLearn::RGBImageVMatrix::length().

{
  return image_distr.length();
}

Here is the call graph for this function:

int PLearn::RGBImagesVMatrix::position ( ) [virtual]

Definition at line 583 of file RGBImage.cc.

References current_image, image_distr, image_start, and PLearn::RGBImageVMatrix::position().

{
  return (int)image_start[current_image] + image_distr.position();
}

Here is the call graph for this function:

void PLearn::RGBImagesVMatrix::reset ( ) [virtual]

Definition at line 543 of file RGBImage.cc.

References current_image, PLearn::RGBImageDB::getImage(), image_distr, PLearn::RGBImageDB::imageIdAndClass, images_db, PLearn::RGBImageVMatrix::reset(), and PLearn::RGBImageVMatrix::setImage().

{ 
  current_image = 0;
  image_distr.setImage(images_db.getImage((int)images_db.imageIdAndClass(0,0)));
  image_distr.reset();
}

Here is the call graph for this function:

void PLearn::RGBImagesVMatrix::sample ( Vec samplevec) [virtual]

Definition at line 550 of file RGBImage.cc.

References append_class, current_image, PLearn::RGBImageVMatrix::first(), PLearn::RGBImageDB::getImage(), image_distr, PLearn::RGBImageDB::imageIdAndClass, images_db, PLearn::TMat< T >::length(), PLearn::TVec< T >::resize(), PLearn::RGBImageVMatrix::sample(), PLearn::RGBImageVMatrix::setImage(), PLearn::TVec< T >::subVec(), and width_.

{ 
  samplevec.resize(width_);
  if (append_class)
    {
      Vec tmpvec = samplevec.subVec(0,width_-1);
      image_distr.sample(tmpvec);
      samplevec[width_-1] = images_db.imageIdAndClass(current_image,1);
    }
  else
    image_distr.sample(samplevec);
      
  if (image_distr.first())
    {
      current_image++;
      if (current_image == images_db.imageIdAndClass.length())
        current_image = 0;
      image_distr.setImage(images_db.getImage((int)images_db.imageIdAndClass(current_image,0)));
    }
}  

Here is the call graph for this function:

void PLearn::RGBImagesVMatrix::seek ( int  position) [virtual]

Definition at line 572 of file RGBImage.cc.

References current_image, PLearn::RGBImageDB::getImage(), i, image_distr, image_start, PLearn::RGBImageDB::imageIdAndClass, images_db, PLearn::TMat< T >::length(), n, PLearn::RGBImageVMatrix::seek(), and PLearn::RGBImageVMatrix::setImage().

{
  int n=images_db.imageIdAndClass.length();
  int i;
  for (i=0;i<n && position>=image_start[i];i++);
  current_image = i-1;
  image_distr.setImage(images_db.getImage((int)images_db.imageIdAndClass(current_image,0)));
  image_distr.seek(int(position-image_start[current_image]));
}

Here is the call graph for this function:

int PLearn::RGBImagesVMatrix::width ( ) [virtual]

Definition at line 540 of file RGBImage.cc.

References width_.

{ return width_; }

Member Data Documentation

Definition at line 280 of file RGBImage.h.

Referenced by RGBImagesVMatrix(), and sample().

Definition at line 279 of file RGBImage.h.

Referenced by position(), reset(), sample(), and seek().

starting "position" (re: position() method) for each image

Definition at line 284 of file RGBImage.h.

Referenced by position(), RGBImagesVMatrix(), and seek().

Definition at line 278 of file RGBImage.h.

Referenced by nObjects(), reset(), RGBImagesVMatrix(), sample(), and seek().

Definition at line 281 of file RGBImage.h.

Referenced by length(), and RGBImagesVMatrix().

Definition at line 283 of file RGBImage.h.

Referenced by RGBImagesVMatrix().

Definition at line 282 of file RGBImage.h.

Referenced by RGBImagesVMatrix().

Definition at line 285 of file RGBImage.h.

Referenced by RGBImagesVMatrix(), sample(), and width().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines