Library of Assembled Shared Sources
lass::io::Image Class Reference

image thing? More...

#include <image.h>

Public Member Functions

 Image ()
 Default constructor.
 
 Image (size_t rows, size_t cols)
 Construct image of given width and height.
 
 Image (const std::string &path)
 Construct image from given file.
 
 Image (const Image &other)
 Copy constructor.
 
 ~Image ()
 Destructor.
 
void reset ()
 Reset image to empty image.
 
void reset (size_t rows, size_t cols)
 Reset image to (black) image of given width.
 
void reset (const std::string &path)
 Reset image to the one in the given file.
 
void reset (const Image &other)
 Reset image to copy of given image.
 
void open (const std::string &path)
 Open image from file.
 
void open (BinaryIStream &stream, const std::string &formatTag)
 Open image from binary stream.
 
void save (const std::string &path)
 Save image to file.
 
void save (BinaryOStream &stream, const std::string &formatTag)
 Save image to file.
 
Imageoperator= (const Image &other)
 Copy other into this image.
 
void swap (Image &other)
 swap two images
 
const TPixeloperator() (size_t row, size_t col) const
 Return const pixel at position row, col.
 
TPixeloperator() (size_t row, size_t col)
 Return reference to pixel at position row, col.
 
const TPixelat (TSignedSize row, TSignedSize col) const
 Return const pixel at position row, col.
 
TPixelat (TSignedSize row, TSignedSize col)
 Return reference to pixel at position row, col.
 
const TPixeldata () const
 Return const data block.
 
TPixeldata ()
 Return data block.
 
const ColorSpace & colorSpace () const
 Return colorSpace of image data.
 
ColorSpace & colorSpace ()
 Return colorSpace of image data.
 
void transformColors (const ColorSpace &newColorSpace)
 Transform the colors from the current color spacer to destColorSpace.
 
size_t rows () const
 Return height of image.
 
size_t cols () const
 Return width of image.
 
bool isEmpty () const
 Return true if image is empty (no data)
 
void over (const Image &other)
 this = this over other
 
void in (const Image &other)
 this = this in other
 
void out (const Image &other)
 this = this out other
 
void atop (const Image &other)
 this = this atop other
 
void through (const Image &other)
 this = this through other
 
void rover (const Image &other)
 this = other over this
 
void rin (const Image &other)
 this = other in this
 
void rout (const Image &other)
 this = other out this
 
void ratop (const Image &other)
 this = other atop this
 
void rthrough (const Image &other)
 this = other through this
 
void plus (const Image &other)
 this = this plus other = other plus this
 
void clampNegatives ()
 clamp all negative pixel components to zero.
 
void filterMedian (size_t boxSize)
 Apply a median filter on image.
 
void filterGamma (TParam gammaExponent)
 apply gamma correction to image
 
void filterExposure (TParam exposureTime)
 apply exposure to image
 
void filterInverseExposure (TParam exposureTime)
 apply exposure to image
 

Detailed Description

image thing?

Author
Bram de Greve [BdG]

Definition at line 76 of file image.h.

Constructor & Destructor Documentation

◆ Image()

lass::io::Image::Image ( )

Default constructor.

empty image.

Definition at line 98 of file image.cpp.

Referenced by atop(), Image(), in(), open(), operator=(), out(), over(), plus(), ratop(), reset(), reset(), reset(), reset(), rin(), rout(), rover(), rthrough(), swap(), and through().

Member Function Documentation

◆ operator()() [1/2]

const Image::TPixel & lass::io::Image::operator() ( size_t row,
size_t col ) const

Return const pixel at position row, col.

Parameters
rowrow of pixel, y coordinate.
colcolumn of pixel, x coordinate.

Definition at line 438 of file image.cpp.

◆ operator()() [2/2]

Image::TPixel & lass::io::Image::operator() ( size_t row,
size_t col )

Return reference to pixel at position row, col.

Parameters
rowrow of pixel, y coordinate.
colcolumn of pixel, x coordinate.

Definition at line 450 of file image.cpp.

◆ at() [1/2]

const Image::TPixel & lass::io::Image::at ( TSignedSize row,
TSignedSize col ) const

Return const pixel at position row, col.

position is wrapped around.

Parameters
rowrow of pixel, y coordinate.
colcolumn of pixel, x coordinate.

Definition at line 462 of file image.cpp.

◆ at() [2/2]

Image::TPixel & lass::io::Image::at ( TSignedSize row,
TSignedSize col )

Return reference to pixel at position row, col.

position is wrapped around.

Parameters
rowrow of pixel, y coordinate.
colcolumn of pixel, x coordinate.

Definition at line 475 of file image.cpp.

◆ colorSpace()

Image::ColorSpace & lass::io::Image::colorSpace ( )

Return colorSpace of image data.

You can change the parameters of the current color space without transforming the pixels. This is most useful if you know that the pixels are in a different color space that the current one is set to. For example, if you know the pixels have a gamma correction 2.2 applied, but the this->colorSpace().gamma == 1.

Definition at line 518 of file image.cpp.

◆ transformColors()

void lass::io::Image::transformColors ( const ColorSpace & newColorSpace)

Transform the colors from the current color spacer to destColorSpace.

The transformation consists of three stages:

  • linearise pixels if gamma of current color space != 1
  • transform colors to linearised destination colour space
  • apply gamma correction if destColorSpace.gamma != 1

For the color transformation, two transformations are concatenated. Both of them will also perform a chromatic adaption transform if the white point of either color space is not the equal energy one (E):

  • from source RGB to XYZ
  • from XYZ to dest RGB

Definition at line 538 of file image.cpp.

References colorSpace(), and filterGamma().

◆ filterMedian()

void lass::io::Image::filterMedian ( size_t boxSize)

Apply a median filter on image.

Parameters
boxSizesize of box filter, must be odd.
  • Filters only pixels with alphachannel != 0.
  • We use the vector median filter for colour images, as described on page in GAUCH J. M. (1998). Noise Removal and contrast enhancement. In: Sangwine S. J. & Horne R. E. N. (Eds.) The Colour Image Processing Handbook. London, Chapman & Hall, 149-162.

Definition at line 760 of file image.cpp.


The documentation for this class was generated from the following files: