#include <Image.h>
Inheritance diagram for Conjecture::Image:
*****************************************************************
Although arbitrary graphical formats will be supported, all formats will be converted to pnm, and the internal memory representation will be pnm-based (mostly pgm, greyscale).
IMPORTANT: This class is an early candidate for disassociation from underlying GOCR C-code reliance. Instead of using the GOCR routines, it will be straight-forward to write our own, or use a universally available library. We can rely on the existence of the 'convert' executable to perform conversions from arbitrary formats to pnm, and provide support here for reading and writing pnm files. THIS CLASS AS-IS WILL GO AWAY SOON!
FUTURE FIX: The 'verbose' flag to the various methods is dirty. Would a static Verbose field be better? Or do we formalize a Config structure that can be used by many classes, and have 'verbose' be one of the fields in this struct? Passing an optional Config pointer seems much cleaner than just passing around a boolean value. Code of the form: pgmWrite("file.pbm", true); just isn't readable, although admittedly pgmWrite("file.pbm", verbose); is more so. But pgmWrite("file.pbm", config); is more general.
Public Member Functions | |
Image (const std::string &file, bool verbose=false) | |
Image (const Image *src, const Coord &topleft, const Coord &bottomright, const ImageArgs &config) | |
u1 | get (u2 x, u2 y) const |
u1 | get (const Coord &pos) const |
void | set (u2 x, u2 y, int val) |
void | set (const Coord &pos, int val) |
bool | writeMono (const std::string &filebase, bool verbose=false) const |
bool | writeGrey (const std::string &filebase, bool verbose=false) const |
bool | writeColor (const std::string &filebase, bool verbose=false) const |
int | bytesPerPixel () const |
Coord | size () const |
uint16_t | width () const |
uint16_t | height () const |
const pix * | data () const |
Static Public Member Functions | |
static void | test (int argc=0, const char *argv[]=NULL) |
Protected Member Functions | |
void | dataIs (pix *data) |
int | index (u2 x, u2 y) const |
|
The height (in pixels) of the image |
|
Returns the one-dimensional index associated with point <x,y> |
|
The size (in pixels) of the image |
|
The width (in pixels) of the image |