Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::RGBImage Class Reference

uses top left coordinate system Pixel (i,j) is at row i, column j More...

#include <RGBImage.h>

Collaboration diagram for PLearn::RGBImage:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RGBImage (int the_height=0, int the_width=0)
 RGBImage (Mat r, Mat g, Mat b)
 r g and b must have values in range [0-255]

 ~RGBImage ()
int width () const
int height () const
void resize (int newheight, int newwidth)
RGB getPixel (int i, int j) const
 return RGB value of Pixel of row i and column j

void setPixel (int i, int j, RGB value)
 sets RGB value of pixel in row i and column j

void fill (RGB color)
void clear ()
void loadPPM (const char *filename)
void savePPM (const char *filename) const
void loadJPEG (const char *filename, int scale=1)
void display () const
void displayAndWait () const
void removeBorders (int top_border, int bottom_border, int left_border, int right_border)
 remove borders around the image

void removeBorders (int border)
 remove borders of thickness "border" from image (in-place), on all sides

void shrinkToIntersection (int &i, int &j, int &h, int &w) const
 shrinks the box that starts at position (i,j) (in this image) and of size (h,w) to its intersection with this image's box (0,0,this->height,this->width_)

void blit (int desti, int destj, RGBImage srcim)
 blits srcim at position (desti,destj) in this image

RGB computeAverage () const
Vec computeHistogram (int r_bins=16, int g_bins=16, int b_bins=16, bool do_normalize=false)
 Returns a vector of size r_bins*g_bins*b_bins which contains the number of image pixels whose colors fell in the corresponding RGB range.


Protected Attributes

int height_
int width_
PP< Storage< RGB > > storage
char tmpfilename [100]
 temporary file in which the image may be saved when displayed


Detailed Description

uses top left coordinate system Pixel (i,j) is at row i, column j

Definition at line 103 of file RGBImage.h.


Constructor & Destructor Documentation

PLearn::RGBImage::RGBImage int  the_height = 0,
int  the_width = 0
 

Definition at line 64 of file RGBImage.cc.

References clear(), height_, storage, tmpfilename, and width_.

PLearn::RGBImage::RGBImage Mat  r,
Mat  g,
Mat  b
 

r g and b must have values in range [0-255]

Definition at line 75 of file RGBImage.cc.

References height_, PLearn::Mat, setPixel(), storage, tmpfilename, and width_.

PLearn::RGBImage::~RGBImage  ) 
 

Definition at line 86 of file RGBImage.cc.

References tmpfilename.


Member Function Documentation

void PLearn::RGBImage::blit int  desti,
int  destj,
RGBImage  srcim
 

blits srcim at position (desti,destj) in this image

Definition at line 224 of file RGBImage.cc.

References getPixel(), height_, setPixel(), shrinkToIntersection(), and width_.

void PLearn::RGBImage::clear  )  [inline]
 

Definition at line 124 of file RGBImage.h.

Referenced by RGBImage().

RGB PLearn::RGBImage::computeAverage  )  const
 

Definition at line 244 of file RGBImage.cc.

References PLearn::RGB::b, PLearn::RGB::g, height_, PLERROR, PLearn::RGB::r, storage, and width_.

Vec PLearn::RGBImage::computeHistogram int  r_bins = 16,
int  g_bins = 16,
int  b_bins = 16,
bool  do_normalize = false
 

Returns a vector of size r_bins*g_bins*b_bins which contains the number of image pixels whose colors fell in the corresponding RGB range.

Definition at line 264 of file RGBImage.cc.

References PLearn::RGB::b, PLearn::RGB::g, getPixel(), height_, PLearn::RGB::r, and width_.

Referenced by PLearn::RGBImageDB::computeHistogramRepresentation().

void PLearn::RGBImage::display  )  const
 

Definition at line 180 of file RGBImage.cc.

References savePPM(), and tmpfilename.

void PLearn::RGBImage::displayAndWait  )  const
 

Definition at line 200 of file RGBImage.cc.

References savePPM(), and tmpfilename.

void PLearn::RGBImage::fill RGB  color  ) 
 

Definition at line 128 of file RGBImage.cc.

References PLearn::color(), height_, PLERROR, storage, and width_.

RGB PLearn::RGBImage::getPixel int  i,
int  j
const [inline]
 

return RGB value of Pixel of row i and column j

Definition at line 153 of file RGBImage.h.

References height_, PLERROR, storage, and width_.

Referenced by blit(), computeHistogram(), and PLearn::RGBImageVMatrix::sample().

int PLearn::RGBImage::height  )  const [inline]
 

Definition at line 118 of file RGBImage.h.

References height_.

Referenced by PLearn::RGBImageVMatrix::RGBImageVMatrix(), and PLearn::RGBImageVMatrix::setImage().

void PLearn::RGBImage::loadJPEG const char *  filename,
int  scale = 1
 

Definition at line 189 of file RGBImage.cc.

References PLearn::endl(), loadPPM(), and tmpfilename.

Referenced by PLearn::RGBImageDB::getImage().

void PLearn::RGBImage::loadPPM const char *  filename  ) 
 

Definition at line 138 of file RGBImage.cc.

References height_, PLERROR, PLWARNING, resize(), storage, and width_.

Referenced by loadJPEG().

void PLearn::RGBImage::removeBorders int  border  )  [inline]
 

remove borders of thickness "border" from image (in-place), on all sides

Definition at line 137 of file RGBImage.h.

References removeBorders().

void PLearn::RGBImage::removeBorders int  top_border,
int  bottom_border,
int  left_border,
int  right_border
 

remove borders around the image

Definition at line 103 of file RGBImage.cc.

References height_, PLERROR, storage, and width_.

Referenced by PLearn::RGBImageDB::getImage(), and removeBorders().

void PLearn::RGBImage::resize int  newheight,
int  newwidth
 

Definition at line 92 of file RGBImage.cc.

References height_, storage, and width_.

void PLearn::RGBImage::savePPM const char *  filename  )  const
 

Definition at line 162 of file RGBImage.cc.

References PLearn::endl(), height_, PLERROR, PLWARNING, storage, and width_.

Referenced by display(), and displayAndWait().

void PLearn::RGBImage::setPixel int  i,
int  j,
RGB  value
[inline]
 

sets RGB value of pixel in row i and column j

Definition at line 165 of file RGBImage.h.

References height_, PLERROR, storage, and width_.

Referenced by blit(), and RGBImage().

void PLearn::RGBImage::shrinkToIntersection int i,
int j,
int h,
int w
const
 

shrinks the box that starts at position (i,j) (in this image) and of size (h,w) to its intersection with this image's box (0,0,this->height,this->width_)

Definition at line 210 of file RGBImage.cc.

References height_, MAX, MIN, and width_.

Referenced by blit().

int PLearn::RGBImage::width  )  const [inline]
 

Definition at line 117 of file RGBImage.h.

References width_.

Referenced by PLearn::RGBImageVMatrix::RGBImageVMatrix(), and PLearn::RGBImageVMatrix::setImage().


Member Data Documentation

int PLearn::RGBImage::height_ [protected]
 

Definition at line 106 of file RGBImage.h.

Referenced by blit(), computeAverage(), computeHistogram(), fill(), getPixel(), height(), loadPPM(), removeBorders(), resize(), RGBImage(), savePPM(), setPixel(), and shrinkToIntersection().

PP< Storage<RGB> > PLearn::RGBImage::storage [protected]
 

Definition at line 109 of file RGBImage.h.

Referenced by computeAverage(), fill(), getPixel(), loadPPM(), removeBorders(), resize(), RGBImage(), savePPM(), and setPixel().

char PLearn::RGBImage::tmpfilename[100] [protected]
 

temporary file in which the image may be saved when displayed

Definition at line 110 of file RGBImage.h.

Referenced by display(), displayAndWait(), loadJPEG(), RGBImage(), and ~RGBImage().

int PLearn::RGBImage::width_ [protected]
 

Definition at line 107 of file RGBImage.h.

Referenced by blit(), computeAverage(), computeHistogram(), fill(), getPixel(), loadPPM(), removeBorders(), resize(), RGBImage(), savePPM(), setPixel(), shrinkToIntersection(), and width().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:07 2004 for PLearn by doxygen 1.3.7