Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

vetFilter Class Reference

Abstract class for all VetLib filters, inherits vetInput and vetOutput classes both, extractTo() and importFrom() methods must be implemented but i/o operators may be overriden by inherited classes. Internal buffering implementation is left to inherited class. More...

#include <vetFilter.h>

Inheritance diagram for vetFilter:

vetInput vetOutput vetObject vetDigitalFilter vetFilterColor vetFilterGeometric vetFilterNoiseChannel vetMultiplexer

Public Types

enum  
 Ignore this, it's a class-type definition, mostly used by VETLib WorkShop, sintax is a bit more complex than usual because of a VC6 BUG, it's the same as: const int vetClassType = VETCLASS_TYPE_FILTER;.

Public Member Functions

 vetFilter (float fps=0)
 Default constructor is protected because this is an abstract class and instance cannot be created directly.
 ~vetFilter ()
 Destructor currenly clear only filters description strings.
virtual VETRESULT setFilterParameters (vetFilterParameters *initParams)=0
 Initialize Filter with any parameters needed, vetFilterParameters should be inherited and implemented for each filter, this is useful for vetProcess and multithreading, after initialization run() call will execute Filter specific processes described in parameters.
virtual VETRESULT reset ()=0
 Inherited class must implement this function, should reset all filters' parameters, something like constructor initialization.
vetFrameYUV420dump_buffer_YUV ()
 Get YUV frame buffer's pointer.
vetFrameRGB24dump_buffer_RGB ()
 Get RGB frame buffer's pointer.
vetFrameT< unsigned char > * dump_buffer_TuC ()
 Get "Template" frame buffer's pointer.
void useBufferYUV (unsigned int width, unsigned int height)
 Update and set current buffer (vetFrameYUV420) to new size.
void useBufferRGB (unsigned int width, unsigned int height)
 Update and set current buffer (vetFrameRGB24) to new size.
void useBufferTuC (unsigned int width, unsigned int height, vetFrame::VETFRAME_PROFILE profile)
 Update and set current buffer (vetFrameT<uchar>) to new size.
bool isBufferYUV ()
 Evaluate is current buffer is a vetFrameYUV420.
bool isBufferRGB ()
 Evaluate is current buffer is a vetFrameRGB24.
bool isBufferTuC ()
 Evaluate is current buffer is a vetFrameT<uchar>.
VETRESULT setHeight (unsigned int value)
 Set current canvas' height.
VETRESULT setWidth (unsigned int value)
 Set current canvas' width.
unsigned int getWidth () const
 Read current canvas's width.
unsigned int getHeight () const
 Read current canvas's height.
bool EoF ()
 Evaluate if there is any data to extract, current implementation just check the state of current buffer.
VETRESULT extractTo (vetFrameYUV420 &img)
 This class offers a base implementatio of extraction methods, it just copies current buffer to output image, no automatic conversion is applied, formats must be the same.
VETRESULT extractTo (vetFrameRGB24 &img)
 This class offers a base implementatio of extraction methods, it just copies current buffer to output image, no automatic conversion is applied, formats must be the same.
VETRESULT extractTo (vetFrameT< unsigned char > &img)
 This class offers a base implementatio of extraction methods, it just copies current buffer to output image, no automatic conversion is applied, formats must be the same.
virtual VETRESULT importFrom (vetFrameYUV420 &img)=0
 Inherited class must implement this function, processing frames to specific output (device or stream).
virtual VETRESULT importFrom (vetFrameRGB24 &img)=0
 Inherited class must implement this function, processing frames to specific output (device or stream).
virtual VETRESULT importFrom (vetFrameT< unsigned char > &img)=0
 Inherited class must implement this function, processing frames to specific output (device or stream).

Protected Member Functions

void allocateBuffer (vetFilterParameters::BUFFER_TYPE bType)
 Allocate the buffer selected BUFFER_TYPE enumeration.
void releaseBuffers ()
 Close and free all buffers, then they are set to NULL.

Protected Attributes

vetFrameYUV420bufferYUV
 Our YUV buffer.
vetFrameRGB24bufferRGB
 Our RGB buffer.
vetFrameT< unsigned char > * bufferTuC
 Our "Template" buffer.

Detailed Description

Abstract class for all VetLib filters, inherits vetInput and vetOutput classes both, extractTo() and importFrom() methods must be implemented but i/o operators may be overriden by inherited classes. Internal buffering implementation is left to inherited class.

See also:
vetInput, vetOutput, vetObject
Version:
1.0.2
Date:
23/12/2005
Author:
Alessandro Polo

Definition at line 154 of file vetFilter.h.


Constructor & Destructor Documentation

vetFilter::vetFilter float  fps = 0  ) 
 

Default constructor is protected because this is an abstract class and instance cannot be created directly.

Parameters:
fps Frame per second value, default is 0, the max input+processing rate.

Definition at line 27 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetObject::setDescription(), vetObject::setName(), and vetObject::setVersion().


Member Function Documentation

void vetFilter::allocateBuffer vetFilterParameters::BUFFER_TYPE  bType  )  [protected]
 

Allocate the buffer selected BUFFER_TYPE enumeration.

Parameters:
bType select the buffer to initialize, if value is NONE or unknown, all buffers are realeased.

Definition at line 66 of file vetFilter.cpp.

References releaseBuffers(), useBufferRGB(), useBufferTuC(), and useBufferYUV().

Referenced by vetFilterNoiseChannel::reset(), vetFilterGeometric::reset(), vetFilterColor::reset(), vetDigitalFilter::reset(), vetFilterNoiseChannel::setParameters(), vetFilterGeometric::setParameters(), vetFilterColor::setParameters(), and vetDigitalFilter::setParameters().

vetFrameRGB24* vetFilter::dump_buffer_RGB  )  [inline]
 

Get RGB frame buffer's pointer.

Note:
DEPRECATED
Returns:
pointer to vetFrameRGB24 buffer or NULL if this buffer is disabled.

Definition at line 253 of file vetFilter.h.

References bufferRGB.

vetFrameT<unsigned char>* vetFilter::dump_buffer_TuC  )  [inline]
 

Get "Template" frame buffer's pointer.

Note:
DEPRECATED
Returns:
pointer to vetFrameT<uchar> buffer or NULL if this buffer is disabled.

Definition at line 262 of file vetFilter.h.

References bufferTuC.

vetFrameYUV420* vetFilter::dump_buffer_YUV  )  [inline]
 

Get YUV frame buffer's pointer.

Note:
DEPRECATED
Returns:
pointer to vetFrameYUV420 buffer or NULL if this buffer is disabled.

Definition at line 244 of file vetFilter.h.

References bufferYUV.

bool vetFilter::EoF  )  [virtual]
 

Evaluate if there is any data to extract, current implementation just check the state of current buffer.

Returns:
true if all buffers are empty.

Implements vetInput.

Definition at line 290 of file vetFilter.cpp.

References bufferRGB, bufferTuC, and bufferYUV.

VETRESULT vetFilter::extractTo vetFrameT< unsigned char > &  img  )  [virtual]
 

This class offers a base implementatio of extraction methods, it just copies current buffer to output image, no automatic conversion is applied, formats must be the same.

Parameters:
[out] img vetFrameT image to store data.
Returns:
VETRET_OK if everything is fine, VETRET_ILLEGAL_USE if current buffer is in a different format or profile.
Note:
Output operator (>>) call directly this function.
See also:
operator >> (vetFrameT<unsigned char>&)

Implements vetInput.

Reimplemented in vetMultiplexer.

Definition at line 326 of file vetFilter.cpp.

References bufferTuC, INFO, isBufferTuC(), VETRET_ILLEGAL_USE, and VETRET_OK.

VETRESULT vetFilter::extractTo vetFrameRGB24 img  )  [virtual]
 

This class offers a base implementatio of extraction methods, it just copies current buffer to output image, no automatic conversion is applied, formats must be the same.

Parameters:
[out] img RGB24 Frame to store data.
Returns:
VETRET_OK if everything is fine, VETRET_ILLEGAL_USE if current buffer is in a different format.
Note:
Output operator (>>) call directly this function.
See also:
operator >> (vetFrameRGB24&)

Implements vetInput.

Reimplemented in vetMultiplexer.

Definition at line 314 of file vetFilter.cpp.

References bufferRGB, INFO, isBufferRGB(), VETRET_ILLEGAL_USE, and VETRET_OK.

VETRESULT vetFilter::extractTo vetFrameYUV420 img  )  [virtual]
 

This class offers a base implementatio of extraction methods, it just copies current buffer to output image, no automatic conversion is applied, formats must be the same.

Parameters:
[out] img YUV 4:2:0 Frame to store data.
Returns:
VETRET_OK if everything is fine, VETRET_ILLEGAL_USE if current buffer is in a different format.
Note:
Output operator (>>) call directly this function.
See also:
operator >> (vetFrameYUV420&)

Implements vetInput.

Reimplemented in vetMultiplexer.

Definition at line 302 of file vetFilter.cpp.

References bufferYUV, INFO, isBufferYUV(), VETRET_ILLEGAL_USE, and VETRET_OK.

unsigned int vetFilter::getHeight  )  const [virtual]
 

Read current canvas's height.

Returns:
Height in pixel.

Implements vetInput.

Definition at line 269 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetFrameT< T >::height, and vetFrame::height.

unsigned int vetFilter::getWidth  )  const [virtual]
 

Read current canvas's width.

Returns:
Width in pixel.

Implements vetInput.

Definition at line 250 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetFrameT< T >::width, and vetFrame::width.

virtual VETRESULT vetFilter::importFrom vetFrameT< unsigned char > &  img  )  [pure virtual]
 

Inherited class must implement this function, processing frames to specific output (device or stream).

Parameters:
[in] img Greyscale VETLib Frame to be processed (encoded for example)
Returns:
VETRET_OK if everything is fine, VETRET_PARAM_ERR if frame is not valid, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.
Note:
Input operator (<<) call directly this function.
See also:
operator << (vetFrameT&)

Implements vetOutput.

Implemented in vetDigitalFilter, vetFilterColor, vetFilterGeometric, vetFilterNoiseChannel, and vetMultiplexer.

virtual VETRESULT vetFilter::importFrom vetFrameRGB24 img  )  [pure virtual]
 

Inherited class must implement this function, processing frames to specific output (device or stream).

Parameters:
[in] img VETLib Cache24 Frame to be processed (encoded for example)
Returns:
VETRET_OK if everything is fine, VETRET_PARAM_ERR if frame is not valid, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.
Note:
Input operator (<<) call directly this function.
See also:
operator << (vetFrameRGB24&)

Implements vetOutput.

Implemented in vetDigitalFilter, vetFilterColor, vetFilterGeometric, vetFilterNoiseChannel, and vetMultiplexer.

virtual VETRESULT vetFilter::importFrom vetFrameYUV420 img  )  [pure virtual]
 

Inherited class must implement this function, processing frames to specific output (device or stream).

Parameters:
[in] img VETLib Cache Frame to be processed (encoded for example)
Returns:
VETRET_OK if everything is fine, VETRET_PARAM_ERR if frame is not valid, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.
Note:
Input operator (<<) call directly this function.
See also:
operator << (vetFrameYUV420&)

Implements vetOutput.

Implemented in vetDigitalFilter, vetFilterColor, vetFilterGeometric, vetFilterNoiseChannel, and vetMultiplexer.

bool vetFilter::isBufferRGB  )  [inline]
 

Evaluate is current buffer is a vetFrameRGB24.

Returns:
true is this is the current buffer, false else.

Definition at line 297 of file vetFilter.h.

References bufferRGB.

Referenced by vetFilterNoiseChannel::AddNoise(), extractTo(), vetFilterGeometric::importFrom(), vetFilterColor::importFrom(), vetDigitalFilter::importFrom(), vetFilterNoiseChannel::MultiplyNoise(), and vetMultiplexer::run().

bool vetFilter::isBufferTuC  )  [inline]
 

Evaluate is current buffer is a vetFrameT<uchar>.

Returns:
true is this is the current buffer, false else.

Definition at line 304 of file vetFilter.h.

References bufferTuC.

Referenced by vetFilterNoiseChannel::AddNoise(), extractTo(), vetFilterGeometric::importFrom(), vetFilterColor::importFrom(), and vetFilterNoiseChannel::MultiplyNoise().

bool vetFilter::isBufferYUV  )  [inline]
 

Evaluate is current buffer is a vetFrameYUV420.

Returns:
true is this is the current buffer, false else.

Definition at line 290 of file vetFilter.h.

References bufferYUV.

Referenced by vetFilterNoiseChannel::AddNoise(), extractTo(), vetFilterGeometric::importFrom(), vetFilterColor::importFrom(), vetDigitalFilter::importFrom(), vetFilterNoiseChannel::MultiplyNoise(), and vetMultiplexer::run().

virtual VETRESULT vetFilter::reset  )  [pure virtual]
 

Inherited class must implement this function, should reset all filters' parameters, something like constructor initialization.

Returns:
VETRET_OK if everything is fine, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.

Implements vetInput.

Implemented in vetDigitalFilter, vetFilterColor, vetFilterGeometric, vetFilterNoiseChannel, and vetMultiplexer.

virtual VETRESULT vetFilter::setFilterParameters vetFilterParameters initParams  )  [pure virtual]
 

Initialize Filter with any parameters needed, vetFilterParameters should be inherited and implemented for each filter, this is useful for vetProcess and multithreading, after initialization run() call will execute Filter specific processes described in parameters.

Returns:
VETRET_OK if all is fine, VETRET_PARAM_ERR if initParams is NULL or not valid, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.

Implemented in vetDigitalFilter, vetFilterColor, vetFilterGeometric, and vetMultiplexer.

VETRESULT vetFilter::setHeight unsigned int  value  )  [virtual]
 

Set current canvas' height.

Returns:
height in pixel.

Implements vetOutput.

Definition at line 198 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetFrameT< T >::reAllocCanvas(), vetFrameRGB24::reAllocCanvas(), vetFrameYUV420::reAllocCanvas(), VETRET_NOT_IMPLEMENTED, VETRET_OK, vetFrameT< T >::width, and vetFrame::width.

VETRESULT vetFilter::setWidth unsigned int  value  )  [virtual]
 

Set current canvas' width.

Returns:
width in pixel.

Implements vetOutput.

Definition at line 224 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetFrameT< T >::height, vetFrame::height, vetFrameT< T >::reAllocCanvas(), vetFrameRGB24::reAllocCanvas(), vetFrameYUV420::reAllocCanvas(), VETRET_NOT_IMPLEMENTED, and VETRET_OK.

void vetFilter::useBufferRGB unsigned int  width,
unsigned int  height
 

Update and set current buffer (vetFrameRGB24) to new size.

Parameters:
[in] width new buffer's width.
[in] height new buffer's height.

Definition at line 143 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetFilterParameters::currentBuffer, vetFrame::height, vetFrameRGB24::reAllocCanvas(), and vetFrame::width.

Referenced by vetFilterNoiseChannel::AddNoise(), allocateBuffer(), vetFilterColor::clamp(), vetFilterColor::extractBitPlane(), vetFilterGeometric::flipHorizontal(), vetFilterGeometric::flipVertical(), vetFilterGeometric::importFrom(), vetFilterColor::importFrom(), vetDigitalFilter::importFrom(), vetFilterColor::invert(), vetFilterNoiseChannel::MultiplyNoise(), vetFilterGeometric::resize(), vetFilterGeometric::resizeCanvas(), vetFilterGeometric::rotate(), vetFilterGeometric::rotate180(), vetFilterGeometric::rotate270(), and vetFilterGeometric::rotate90().

void vetFilter::useBufferTuC unsigned int  width,
unsigned int  height,
vetFrame::VETFRAME_PROFILE  profile
 

Update and set current buffer (vetFrameT<uchar>) to new size.

Parameters:
[in] width new buffer's width.
[in] height new buffer's height.

Definition at line 170 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetFilterParameters::currentBuffer, vetFrameT< T >::height, vetFrameT< T >::reAllocCanvas(), and vetFrameT< T >::width.

Referenced by vetFilterNoiseChannel::AddNoise(), allocateBuffer(), vetFilterGeometric::flipHorizontal(), vetFilterGeometric::flipVertical(), vetFilterGeometric::importFrom(), vetFilterColor::importFrom(), vetFilterNoiseChannel::MultiplyNoise(), vetFilterGeometric::resize(), vetFilterGeometric::resizeCanvas(), vetFilterGeometric::rotate(), vetFilterGeometric::rotate180(), vetFilterGeometric::rotate270(), and vetFilterGeometric::rotate90().

void vetFilter::useBufferYUV unsigned int  width,
unsigned int  height
 

Update and set current buffer (vetFrameYUV420) to new size.

Parameters:
[in] width new buffer's width.
[in] height new buffer's height.

Definition at line 116 of file vetFilter.cpp.

References bufferRGB, bufferTuC, bufferYUV, vetFilterParameters::currentBuffer, vetFrame::height, vetFrameYUV420::reAllocCanvas(), and vetFrame::width.

Referenced by vetFilterNoiseChannel::AddNoise(), allocateBuffer(), vetFilterGeometric::flipHorizontal(), vetFilterGeometric::flipVertical(), vetFilterGeometric::importFrom(), vetFilterColor::importFrom(), vetDigitalFilter::importFrom(), vetFilterNoiseChannel::MultiplyNoise(), vetFilterGeometric::resize(), vetFilterGeometric::resizeCanvas(), vetFilterGeometric::rotate(), vetFilterGeometric::rotate180(), vetFilterGeometric::rotate270(), and vetFilterGeometric::rotate90().


The documentation for this class was generated from the following files:
Generated on Tue Jan 24 11:59:32 2006 for VETLib by  doxygen 1.4.4