PLearn 0.1
|
#include <RGBImage.h>
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 |
RGBImageDB & | images_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_ |
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.
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); } }
bool PLearn::RGBImagesVMatrix::firstSampleOfObject | ( | ) | [virtual] |
Definition at line 588 of file RGBImage.cc.
References PLearn::RGBImageVMatrix::first(), and image_distr.
{ return image_distr.first(); }
int PLearn::RGBImagesVMatrix::length | ( | ) | [virtual] |
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(); }
int PLearn::RGBImagesVMatrix::nSamplesOfObject | ( | ) | [virtual] |
Definition at line 593 of file RGBImage.cc.
References image_distr, and PLearn::RGBImageVMatrix::length().
{ return image_distr.length(); }
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(); }
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(); }
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))); } }
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])); }
int PLearn::RGBImagesVMatrix::width | ( | ) | [virtual] |
bool PLearn::RGBImagesVMatrix::append_class [protected] |
Definition at line 280 of file RGBImage.h.
Referenced by RGBImagesVMatrix(), and sample().
int PLearn::RGBImagesVMatrix::current_image [protected] |
Definition at line 279 of file RGBImage.h.
Referenced by position(), reset(), sample(), and seek().
RGBImageVMatrix PLearn::RGBImagesVMatrix::image_distr [protected] |
Definition at line 277 of file RGBImage.h.
Referenced by firstSampleOfObject(), nSamplesOfObject(), position(), reset(), RGBImagesVMatrix(), sample(), and seek().
Vec PLearn::RGBImagesVMatrix::image_start [protected] |
starting "position" (re: position() method) for each image
Definition at line 284 of file RGBImage.h.
Referenced by position(), RGBImagesVMatrix(), and seek().
RGBImageDB& PLearn::RGBImagesVMatrix::images_db [protected] |
Definition at line 278 of file RGBImage.h.
Referenced by nObjects(), reset(), RGBImagesVMatrix(), sample(), and seek().
int PLearn::RGBImagesVMatrix::length_ [protected] |
Definition at line 281 of file RGBImage.h.
Referenced by length(), and RGBImagesVMatrix().
Vec PLearn::RGBImagesVMatrix::pixels [protected] |
Definition at line 283 of file RGBImage.h.
Referenced by RGBImagesVMatrix().
Vec PLearn::RGBImagesVMatrix::pixelsAndClass [protected] |
Definition at line 282 of file RGBImage.h.
Referenced by RGBImagesVMatrix().
int PLearn::RGBImagesVMatrix::width_ [protected] |
Definition at line 285 of file RGBImage.h.
Referenced by RGBImagesVMatrix(), sample(), and width().