GClasses
GClasses::GImageJitterer Class Reference

Given an image encoded as a rasterized row of channel values, this class computes a single pixel drawn from the image as if the image had been rotated, translated, and zoomed by a small random amount. (The purpose of this class is to make it possible to train GUnsupervisedBackProp to understand these common image-based transformations.) More...

#include <GManifold.h>

Public Member Functions

 GImageJitterer (size_t wid, size_t hgt, size_t channels, double rotateDegrees, double translateWidths, double zoomFactor)
 if rotateDegrees is 30.0, then it will rotate the image up to 15.0 degrees in either direction. if translateWidths is 1.0, then it will translate between -0.5*wid and 0.5*wid. It will also translate vertically by a value in the same range (dependant on wid, not hgt). if zoomFactor is 2.0, then it will scale between a factor of 0.5 and 2.0. More...
 
 GImageJitterer (GDomNode *pNode)
 Deserializing constructor. More...
 
size_t channels ()
 Returns the number of channels. More...
 
size_t hgt ()
 Returns the height of the images. More...
 
double * pickParams (GRand &rand)
 Sets the 4 params to random uniform values between 0 and 1, and returns the params. More...
 
GDomNodeserialize (GDom *pDoc) const
 Marshall this object into a DOM that can be serialized. More...
 
void transformedPix (const double *pRow, size_t x, size_t y, double *pOut)
 Returns the specified pixel in the transformed image. More...
 
size_t wid ()
 Returns the width of the images. More...
 

Static Public Member Functions

static void test (const char *filename)
 

Protected Member Functions

void interpolate (const double *pRow, double x, double y, double *pOut)
 

Detailed Description

Given an image encoded as a rasterized row of channel values, this class computes a single pixel drawn from the image as if the image had been rotated, translated, and zoomed by a small random amount. (The purpose of this class is to make it possible to train GUnsupervisedBackProp to understand these common image-based transformations.)

Constructor & Destructor Documentation

GClasses::GImageJitterer::GImageJitterer ( size_t  wid,
size_t  hgt,
size_t  channels,
double  rotateDegrees,
double  translateWidths,
double  zoomFactor 
)

if rotateDegrees is 30.0, then it will rotate the image up to 15.0 degrees in either direction. if translateWidths is 1.0, then it will translate between -0.5*wid and 0.5*wid. It will also translate vertically by a value in the same range (dependant on wid, not hgt). if zoomFactor is 2.0, then it will scale between a factor of 0.5 and 2.0.

GClasses::GImageJitterer::GImageJitterer ( GDomNode pNode)

Deserializing constructor.

Member Function Documentation

size_t GClasses::GImageJitterer::channels ( )
inline

Returns the number of channels.

size_t GClasses::GImageJitterer::hgt ( )
inline

Returns the height of the images.

void GClasses::GImageJitterer::interpolate ( const double *  pRow,
double  x,
double  y,
double *  pOut 
)
protected
double* GClasses::GImageJitterer::pickParams ( GRand rand)

Sets the 4 params to random uniform values between 0 and 1, and returns the params.

GDomNode* GClasses::GImageJitterer::serialize ( GDom pDoc) const

Marshall this object into a DOM that can be serialized.

static void GClasses::GImageJitterer::test ( const char *  filename)
static
void GClasses::GImageJitterer::transformedPix ( const double *  pRow,
size_t  x,
size_t  y,
double *  pOut 
)

Returns the specified pixel in the transformed image.

size_t GClasses::GImageJitterer::wid ( )
inline

Returns the width of the images.