Image Component Library (ICL)
|
Simple class for creation of a run-length encoding of an image. More...
#include <RunLengthEncoder.h>
Public Member Functions | |
void | encode (const core::ImgBase *image) |
main encoding function More... | |
WorkingLineSegment * | begin (int row) |
Returns a begin()-pointer for the first encoded image line. More... | |
const WorkingLineSegment * | begin (int row) const |
Returns a begin()-pointer for the first encoded image line (const) More... | |
WorkingLineSegment * | end (int row) |
Returns a end()-pointer for the first encoded image line. More... | |
const WorkingLineSegment * | end (int row) const |
Returns a end()-pointer for the first encoded image line (const) More... | |
Private Types | |
typedef WorkingLineSegment | WLS |
internal typedef More... | |
Private Member Functions | |
template<class T > | |
void | encode_internal (const core::Img< T > &image) |
internal run-length-encoding template More... | |
void | prepare (const utils::Rect &roi) |
internal preparation function (automatically called) More... | |
void | resetLineSegments () |
resets all formerly used line segments (automatically called) More... | |
Private Attributes | |
std::vector< WLS > | m_data |
internal data buffer More... | |
std::vector< WLS * > | m_ends |
internal buffer for line ends More... | |
utils::Rect | m_imageROI |
current image ROI, the RunLengthEncoder is optimized for (adatped automatically) More... | |
Simple class for creation of a run-length encoding of an image.
Run-length encoding means that each image line is transformed into a set of so called LineSegments. Each of these Segments represents a sequence of adjacent image pixels that have the same value. By this means, uniform image Regions can be compressed significantly. However, if there are only short LineSegments, run-length-encoding might provide a larger encoding.
The RunLengthEncoder class uses WorkingLineSegments internally, where each of these subsumes the following information xstart (x-coordinate of the left-most point of the line segment) xend (x-coordinate of the pixel right to the right-most pixel of the line segment) y (the row index) value (the underlying value) anyData (a pointer to addinional information that might be used by other algorithms that use the RunLengthEncoder class
The RunLengthEncoder's main function is RunLengthEncoder::encode(const core::core::Img<T>&, const utils::Point&). After encode was called, the run-length-encoded representation of each image line can be accessed using RunLengthEncoder::begin(int) and RunLengthEncoder::end(int).
As the used WorkingLineSegment class provides only an int-value parameter, the RunLengthEncoder is not able to process icl32f and icl64f images
The RunLengthEncoder provides ROI support. The internal encoding function is implemented twice (with and without ROI handling) because handling of an images ROI entails a few extra computation steps (e.g. shifting of line segments by roi offset). If an input image is used, that has a non-full ROI, the internal WorkingLineSegment buffer is optimized for that ROI size. Furthermore, the buffer containing the line end pointers will also be resized to the input images ROI-height. Therefore the given row-indices for the RunLengthEncoder::begin(int) and RunLengthEncoder::end(int) functions is always relative to the input images roi-offset.
image (size: 10x7, roi: (1,2)4x3) .......... .......... .xxxxx.... <- begin(0) and end(0) refer to this line .xxxxx.... .xxxxx.... <- begin(2) and end(2) refer to this line .......... ..........
xstart, xend and y
|
private |
internal typedef
|
inline |
Returns a begin()-pointer for the first encoded image line.
row-indices are always relative to the image ROI's offset (see ROI-Support)
|
inline |
Returns a begin()-pointer for the first encoded image line (const)
row-indices are always relative to the image ROI's offset (see ROI-Support)
void icl::cv::RunLengthEncoder::encode | ( | const core::ImgBase * | image | ) |
main encoding function
|
private |
internal run-length-encoding template
|
inline |
Returns a end()-pointer for the first encoded image line.
row-indices are always relative to the image ROI's offset (see ROI-Support)
|
inline |
Returns a end()-pointer for the first encoded image line (const)
row-indices are always relative to the image ROI's offset (see ROI-Support)
|
private |
internal preparation function (automatically called)
|
private |
resets all formerly used line segments (automatically called)
|
private |
internal data buffer
|
private |
internal buffer for line ends
|
private |
current image ROI, the RunLengthEncoder is optimized for (adatped automatically)