#include <deinterlacebuffer.h>
The majority of commands are passed straight through to the buffer that this class wraps, but get_frame() is overloaded to extract fields from the video frames.
Video intended for television use (i.e. from non-progressive scan cameras) tends to be interlaced. Instead of grabbing the entire frame at one time instant, the image is grabbed in two parts (fields), made up of the odd-numbered lines and the even-numbered lines respectively (thus giving an effective field-rate of twice the video frame-rate. Any fast motion in frame will therefore exhibit serrated distortion, with alternate lines out of step.
This class returns individual fields from the video, which are guaranteed to represent a single time instant. The VideoFrames returned from this buffer are therefore half the height of the original image, and so you might want to double the y-scale before displaying.
Provides frames of type CVD::DeinterlaceFrame and throws exceptions of type CVD::Exceptions::DeinterlaceBuffer
T | The pixel type of the original VideoBuffer |
Definition at line 77 of file deinterlacebuffer.h.
Public Types | |
enum | Fields { OddOnly, EvenOnly, OddEven, EvenOdd } |
Public Member Functions | |
DeinterlaceBuffer (CVD::VideoBuffer< T > &buf, Fields fields=OddEven) | |
ImageRef | size () |
CVD::VideoFrame< T > * | get_frame () |
void | put_frame (CVD::VideoFrame< T > *f) |
virtual bool | frame_pending () |
virtual void | seek_to (double t) |
virtual double | frame_rate () |
enum CVD::DeinterlaceBuffer::Fields |
Used to select which fields, and in which order, to extract from the frame.
OddOnly | Odd fields only. |
EvenOnly | Even fields only. |
OddEven | Both fields, presenting the odd lines from each frame first. |
EvenOdd | Both fields, presenting the even lines from each frame first. |
Definition at line 81 of file deinterlacebuffer.h.
CVD::DeinterlaceBuffer< T >::DeinterlaceBuffer | ( | CVD::VideoBuffer< T > & | buf, | |
Fields | fields = OddEven | |||
) | [inline] |
Construct a DeinterlaceBuffer by wrapping it around another VideoBuffer.
buf | The buffer that will provide the raw frames | |
fields | The fields to |
Definition at line 132 of file deinterlacebuffer.h.
References CVD::ImageRef::x.
ImageRef CVD::DeinterlaceBuffer< T >::size | ( | ) | [inline, virtual] |
The size of the VideoFrames returns by this buffer.
This will be half the height of the original frames.
Implements CVD::VideoBuffer< T >.
Definition at line 209 of file deinterlacebuffer.h.
References CVD::ImageRef::x, and CVD::ImageRef::y.
VideoFrame< T > * CVD::DeinterlaceBuffer< T >::get_frame | ( | ) | [inline, virtual] |
Returns the next frame from the buffer. This function blocks until a frame is ready.
Implements CVD::VideoBuffer< T >.
Definition at line 150 of file deinterlacebuffer.h.
References CVD::SubImage< T >::data(), CVD::DeinterlaceBuffer< T >::EvenOdd, CVD::DeinterlaceBuffer< T >::frame_rate(), CVD::DeinterlaceBuffer< T >::OddEven, CVD::DeinterlaceBuffer< T >::OddOnly, CVD::DeinterlaceFrame< T >::real_frame, CVD::ImageRef::x, and CVD::ImageRef::y.
void CVD::DeinterlaceBuffer< T >::put_frame | ( | CVD::VideoFrame< T > * | f | ) | [inline, virtual] |
Tell the buffer that you are finished with this frame.
Typically the VideoBuffer then destroys the frame.
f | The frame that you are finished with. |
Implements CVD::VideoBuffer< T >.
Definition at line 219 of file deinterlacebuffer.h.
References CVD::SubImage< T >::data().
virtual bool CVD::DeinterlaceBuffer< T >::frame_pending | ( | ) | [inline, virtual] |
Is there a frame waiting in the buffer? This function does not block.
See is_live and is_flushable.
Implements CVD::VideoBuffer< T >.
Definition at line 102 of file deinterlacebuffer.h.
virtual void CVD::DeinterlaceBuffer< T >::seek_to | ( | double | ) | [inline, virtual] |
Go to a particular point in the video buffer (only implemented in buffers of recorded video).
t | The frame time in seconds |
Reimplemented from CVD::VideoBuffer< T >.
Definition at line 105 of file deinterlacebuffer.h.
virtual double CVD::DeinterlaceBuffer< T >::frame_rate | ( | ) | [inline, virtual] |
What is the (expected) frame rate of this video buffer, in frames per second? If OddEven or EvenOdd are selected, this will be reported as twice the original buffer's rate.
Implements CVD::VideoBuffer< T >.
Definition at line 111 of file deinterlacebuffer.h.
References CVD::DeinterlaceBuffer< T >::EvenOnly, and CVD::DeinterlaceBuffer< T >::OddOnly.
Referenced by CVD::DeinterlaceBuffer< T >::get_frame().