golib
0.5
|
Video capture class. More...
#include <govideocapture.h>
Public Types | |
enum | ColourMode { RGB24, YUV422P, YUV420P, GREY } |
Public Member Functions | |
goVideoCapture (const char *devname, goSize_t width, goSize_t height) | |
bool | setDevice (const char *name) |
Set device file name. More... | |
void | setFileDescriptor (int fd) |
Set file discriptor of an already open device. More... | |
int | getFileDescriptor () const |
Get file descriptor for open device. More... | |
bool | setCaptureSize (goSize_t width, goSize_t height) |
Set capture frame size. More... | |
goSize_t | getCaptureWidth () const |
Capture frame width. More... | |
goSize_t | getCaptureHeight () const |
Capture frame height. More... | |
void | setColourMode (enum ColourMode vm) |
Sets the colour mode. More... | |
enum ColourMode | getColourMode () const |
Get the colour mode this object is currently set to. More... | |
bool | open () |
Open the device. More... | |
void | close () |
Close the open device. | |
bool | grab (goSignal3DBase< void > &signal, const int *rgb_channels) |
Grab a frame from the open device. More... | |
bool | grab (goSignal3D< void > &signal, const int *rgb_channels) |
Convenience method. More... | |
bool | grab (void *buffer, goSize_t size) |
Grab a frame from the open device. More... | |
bool | checkCapture () const |
Check if video capture is available by the open device. More... | |
bool | setSettings () |
Store settings from this object to the open device. More... | |
void | getSettings () |
Get settings from device and store them internally. It is a good idea to call this after opening a device. It is also called by setFileDescriptor(). This method calls getCapabilities() and getCaptureWindow(). | |
void | getValidRanges () |
Get valid ranges for brightnes etc. More... | |
void | setBrightness (double b) |
double | getBrightness () const |
void | setHue (double b) |
double | getHue () const |
void | setColour (double b) |
double | getColour () const |
void | setContrast (double b) |
double | getContrast () const |
void | setWhiteness (double b) |
double | getWhiteness () const |
void | printImageProperties (goString &ret) |
![]() | |
goObjectBase () | |
Constructor. | |
virtual | ~goObjectBase () |
Destructor. More... | |
const char * | getClassName () const |
Returns the class name. More... | |
int | getClassID () const |
virtual goSize_t | memoryUsage () const |
Returns the size of this object or some measure of its memory consumption. More... | |
void | setObjectName (const char *name) |
Set name string for an object. More... | |
void | setObjectName (const goString &name) |
Set name string for an object. More... | |
const goString & | getObjectName () const |
Get the object name. More... | |
virtual bool | writeObjectFile (FILE *) const |
Write object to a file. More... | |
virtual bool | readObjectFile (FILE *) |
Read object from a file. More... | |
void | connectObject (goObjectBase *object) |
Connects an object to this object. More... | |
void | disconnectObject (const goObjectBase *object) |
Disconnects an object from this object. | |
virtual bool | callObjectMethod (int methodID, goObjectMethodParameters *param=NULL) |
Call an object method by identifier. More... | |
virtual bool | queueObjectMethod (int methodID, goObjectMethodParameters *param=NULL, bool blocking=false) |
Enqueue a method call to an internal list of methods. More... | |
bool | callQueuedMethods () |
Call all queued methods. More... | |
Protected Member Functions | |
void | getCapabilities () |
Gets device capabilities and stores them internally. Called, amongst others, by getSettings(). | |
void | getCaptureWindow () |
Get the size of the capture frame from the device and store it internally. It can be retrieved with getCapture[Width|Height](). | |
![]() | |
void | setClassID (int id) |
Sets the class name. | |
void | printClassMessage (const char *msg) |
Sets the class name. More... | |
void | printClassMessage (goString &msg) |
Prints an informational message to the calling console. More... | |
void | sendObjectMessage (int messageID, void *data=NULL) |
Sends a message to all connected objects. | |
void | sendObjectMessage (goObjectBase *object, int messageID, void *data=NULL) |
Sends a message to a specific object. | |
virtual void | receiveObjectMessage (const goObjectMessage &message) |
Receive a message. More... | |
Video capture class.
This class allows video capture, currently only from video4linux (version 1) devices. Version 2 will follow when the drivers for our cameras support it and there is need.
bool goVideoCapture::checkCapture | ( | ) | const |
Check if video capture is available by the open device.
goSize_t goVideoCapture::getCaptureHeight | ( | ) | const |
Capture frame height.
goSize_t goVideoCapture::getCaptureWidth | ( | ) | const |
Capture frame width.
enum goVideoCapture::ColourMode goVideoCapture::getColourMode | ( | ) | const |
Get the colour mode this object is currently set to.
int goVideoCapture::getFileDescriptor | ( | ) | const |
Get file descriptor for open device.
void goVideoCapture::getValidRanges | ( | ) |
Get valid ranges for brightnes etc.
bool goVideoCapture::grab | ( | goSignal3D< void > & | target, |
const int * | rgb_channels | ||
) |
Convenience method.
Calls grab (goSignal3DBase<void>&), changing type and size of target if necessary.
target | Target containing the image if return value is true. |
rgb_channels | Contains 3 integers, each denoting the channel number in target for r, g, and b respectively. |
bool goVideoCapture::grab | ( | goSignal3DBase< void > & | target, |
const int * | rgb_channels | ||
) |
Grab a frame from the open device.
target | Target. Must currently be linear in memory (block size == signal size), of type GO_UINT8 and must have 3 channels if the colour mode is RGB24. |
rgb_channels | Contains 3 integers, each denoting the channel number in target for r, g, and b respectively. |
bool goVideoCapture::grab | ( | void * | target, |
goSize_t | sz | ||
) |
Grab a frame from the open device.
target | Target pointer to memory of size sz bytes. |
sz | Maximum of sz bytes is read from the open device. |
bool goVideoCapture::open | ( | ) |
Open the device.
Set capture frame size.
width | Width in pixels. |
height | Height in pixels. |
void goVideoCapture::setColourMode | ( | enum ColourMode | vm | ) |
Sets the colour mode.
m | Colour mode enumerator. |
bool goVideoCapture::setDevice | ( | const char * | name | ) |
Set device file name.
name | Device file name, e.g. "/dev/video0" |
void goVideoCapture::setFileDescriptor | ( | int | fd | ) |
Set file discriptor of an already open device.
Sets the descriptor and automatically reads settings from the device to update the settings stored in the goVideoCapture object.
fd | File descriptor. |
bool goVideoCapture::setSettings | ( | ) |
Store settings from this object to the open device.