GClasses
|
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. | |
GImageJitterer (GDomNode *pNode) | |
Deserializing constructor. | |
GDomNode * | serialize (GDom *pDoc) |
Marshall this object into a DOM that can be serialized. | |
double * | pickParams (GRand &rand) |
Sets the 4 params to random uniform values between 0 and 1, and returns the params. | |
void | transformedPix (const double *pRow, size_t x, size_t y, double *pOut) |
Returns the specified pixel in the transformed image. | |
size_t | channels () |
Returns the number of channels. | |
size_t | wid () |
Returns the width of the images. | |
size_t | hgt () |
Returns the height of the images. | |
Static Public Member Functions | |
static void | test (const char *filename) |
Protected Member Functions | |
void | interpolate (const double *pRow, double x, double y, double *pOut) |
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.)
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.
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.
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.