|
Public Methods |
| | Image () |
| | Creates a new image of GrayChar, but with no buffer memory allocated.
|
| | Image (const PixelFormat &format) |
| | Same as above, but with given PixelFormat.
|
| | Image (int width, int height) |
| | Allocates buffer of size width x height x GrayChar.depth bytes.
|
| | Image (int width, int height, const PixelFormat &format) |
| | Same as above, but with given PixelFormat.
|
| | Image (const Image &that) |
| | Points our buffer to same location as "that" and copies all of its metadata.
|
| | Image (unsigned char *buffer, int width, int height, const PixelFormat &format) |
| | Binds to an external block of memory.
|
| | Image (const std::string &fileName) |
| | Create image initialized with contents of file.
|
| void | read (const std::string &fileName) |
| | Read image from fileName. Format will be determined automatically.
|
| void | read (std::istream &stream) |
| void | write (const std::string &fileName, const std::string &formatName="pgm") const |
| | Write image to fileName.
|
| void | write (std::ostream &stream, const std::string &formatName="pgm") const |
| Image & | operator<<= (const Image &that) |
| | Direct assignment by shallow copy. Same semantics as "=". By using a different operator than "=", we allow subclasses to inherit this function.
|
| void | copyFrom (const Image &that) |
| | Duplicates another Image. Copy all raster info into private buffer, and copy all other metadata.
|
| void | copyFrom (unsigned char *buffer, int width, int height, const PixelFormat &format) |
| | Copy from a non-Image source. Determine size of buffer in bytes as width x height x depth.
|
| void | attach (unsigned char *buffer, int width, int height, const PixelFormat &format) |
| | Binds to an external block of memory.
|
| void | detach () |
| | Set the state of this image as if it has no buffer. Releases (but only frees if appropriate) any memory.
|
| void | resize (int width, int height) |
| | Changes image to new size. Any pixels that are still visible are aligned correctly. Any newly exposed pixels are set to black.
|
| void | bitblt (const Image &that, int toX=0, int toY=0, int fromX=0, int fromY=0, int width=-1, int height=-1) |
| | -1 for width or height means "maximum possible value"
|
| void | clear (unsigned int rgba=0) |
| | Initialize buffer, if it exists, to given color. In case rgba == 0, simply zeroes out memory, since this generally results in black in most pixel formats.
|
| Image | operator+ (const Image &that) |
| | Creates an image that sums pixel values from this and that.
|
| Image | operator- (const Image &that) |
| | Creates an image whose pixels are the difference between this and that.
|
| Image | operator * (double factor) |
| | Creates an image containing this images's pixels scaled by factor. Ie: factor == 1 -> no change; factor == 2 -> bright spots are twice as bright, and dark spots (negative values relative to bias) are twice as dark.
|
| Image & | operator *= (double factor) |
| | Scales each pixel by factor.
|
| Image & | operator+= (double value) |
| | Adds value to each pixel.
|
| Pixel | operator() (int x, int y) const |
| | Returns a Pixel object that wraps (x,y).
|
| unsigned int | getRGBA (int x, int y) const |
| | The "RGB" functions are intended for abstract access to the buffer. They perform conversion to whatever the buffer's format is.
|
| void | getRGBA (int x, int y, float values[]) const |
| unsigned int | getYUV (int x, int y) const |
| unsigned char | getGray (int x, int y) const |
| void | getGray (int x, int y, float &gray) const |
| unsigned char | getAlpha (int x, int y) const |
| void | setRGBA (int x, int y, unsigned int rgba) |
| | The "rgb" format is always 24-bit RGB, 8 bits per field. Blue is in the least significant byte, then green, then red.
|
| void | setRGBA (int x, int y, float values[]) |
| void | setYUV (int x, int y, unsigned int yuv) |
| void | setGray (int x, int y, unsigned char gray) |
| void | setGray (int x, int y, float gray) |
| void | setAlpha (int x, int y, unsigned char alpha) |
Public Attributes |
| Pointer | buffer |
| const PixelFormat * | format |
| int | width |
| | The Image class guarantees that width * height is always non-negative and that the raster stored in buffer has enough allocated memory to contain width * height pixels. (Of course, you can set this field directly, in which case the warranty is void. :).
|
| int | height |
| | See width for interface guarantees.
|
| double | timestamp |
| | Time when image was captured. If part of a video, then time when image should be displayed.
|