Image Component Library (ICL)
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
icl::cv::RunLengthEncoder Class Reference

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...
 
WorkingLineSegmentbegin (int row)
 Returns a begin()-pointer for the first encoded image line. More...
 
const WorkingLineSegmentbegin (int row) const
 Returns a begin()-pointer for the first encoded image line (const) More...
 
WorkingLineSegmentend (int row)
 Returns a end()-pointer for the first encoded image line. More...
 
const WorkingLineSegmentend (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< WLSm_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...
 

Detailed Description

Simple class for creation of a run-length encoding of an image.

General Information

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.

WorkingLineSegments

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

Usage

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).

Supported Image Depths

As the used WorkingLineSegment class provides only an int-value parameter, the RunLengthEncoder is not able to process icl32f and icl64f images

ROI-Support

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

Member Typedef Documentation

◆ WLS

internal typedef

Member Function Documentation

◆ begin() [1/2]

WorkingLineSegment* icl::cv::RunLengthEncoder::begin ( int  row)
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)

◆ begin() [2/2]

const WorkingLineSegment* icl::cv::RunLengthEncoder::begin ( int  row) const
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)

◆ encode()

void icl::cv::RunLengthEncoder::encode ( const core::ImgBase image)

main encoding function

◆ encode_internal()

template<class T >
void icl::cv::RunLengthEncoder::encode_internal ( const core::Img< T > &  image)
private

internal run-length-encoding template

◆ end() [1/2]

WorkingLineSegment* icl::cv::RunLengthEncoder::end ( int  row)
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)

◆ end() [2/2]

const WorkingLineSegment* icl::cv::RunLengthEncoder::end ( int  row) const
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)

◆ prepare()

void icl::cv::RunLengthEncoder::prepare ( const utils::Rect roi)
private

internal preparation function (automatically called)

◆ resetLineSegments()

void icl::cv::RunLengthEncoder::resetLineSegments ( )
private

resets all formerly used line segments (automatically called)

Member Data Documentation

◆ m_data

std::vector<WLS> icl::cv::RunLengthEncoder::m_data
private

internal data buffer

◆ m_ends

std::vector<WLS*> icl::cv::RunLengthEncoder::m_ends
private

internal buffer for line ends

◆ m_imageROI

utils::Rect icl::cv::RunLengthEncoder::m_imageROI
private

current image ROI, the RunLengthEncoder is optimized for (adatped automatically)


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