#include <qvmplayercamera/qvmplayercamera.h>
Public Types | |
enum | OpenOption { Default = 0x0, RealTime = 0x1, Deinterlaced = 0x2, NoLoop = 0x4, RGBMEncoder = 0x8 } |
Public Slots | |
bool | grab () |
Grabs a frame from camera input. | |
void | pauseCam () |
void | unpauseCam () |
void | nextFrameCam () |
void | setSpeedCam (double d) |
Set the camera speed. | |
void | seekCam (QVCamera::TSeekType type, double pos) |
Moves the camera file to a given position. | |
void | closeCam () |
bool | link (QVWorker *, QString imageName) |
bool | link (QVWorker *, const QString imageY, const QString imageU, const QString imageV) |
Public Member Functions | |
QVMPlayerCamera (QString name=QString()) | |
~QVMPlayerCamera () | |
bool | openCam (const QString &url, OpenOptions opts=Default) |
Opens a mplayer source given by its URL. | |
bool | openCam (const QString &urlstring, unsigned int r, unsigned int c, OpenOptions opts=Default) |
Opens a mplayer source given by its URL, and scales output to a requested size. | |
bool | openCam () |
Opens a mplayer source using the internal properties assigned to it. (Overloaded function, provided by convenience; see QVPropertyHolder for details on properties). Used properties:
| |
bool | grab (QVImage< uChar, 3 > &image) |
Grabs a frame in RGB format. | |
bool | grab (QVImage< uChar, 1 > &image) |
Grabs a gray scale frame. | |
bool | grab (QVImage< uChar > &imgY, QVImage< uChar > &imgU, QVImage< uChar > &imgV) |
Grabs a frame in YUV format. | |
const QString | getUrlBase () const |
Returns the current camera name (without path). | |
OpenOptions | getOptions () const |
Returns current camera options. | |
int | getBufferSize () const |
Returns the current frame buffer size. | |
unsigned int | getFramesUpdated () const |
Returns the total number of updated frames. | |
unsigned int | getRows () const |
Returns the number of rows of the buffer. | |
unsigned int | getCols () const |
Returns the number of cols of the buffer. | |
double | getFPS () const |
Returns the camera speed in frames per second. | |
double | getTimeLength () const |
Returns the video file length in seconds. | |
double | getTimePos () const |
Returns the current video position in seconds. | |
double | getSpeed () const |
Returns the current video speed. | |
unsigned int | getFramesGrabbed () const |
Returns number of frames grabbed. | |
unsigned int | getFramesRead () const |
Returns number of frames read. | |
bool | isLiveCamera () const |
Tells if the camera is a live camera. | |
Static Public Member Functions | |
static bool | getFrame (const QString uri, QVImage< uChar, 3 > &img, int frame=0) |
Grabs a RGB image, from a camera specified with an URI. | |
static bool | getFrame (const QString uri, QVImage< uChar, 1 > &img, int frame=0) |
Grabs a gray image, from a camera specified with an URI. | |
static bool | getFrame (const QString uri, QVImage< uChar > &imgY, QVImage< uChar > &imgU, QVImage< uChar > &imgV, int frame=0) |
Grabs a YUV image, from a camera specified with an URI. |
Definition at line 159 of file qvmplayercamera.h.
Open options for a mplayer camera. Combine them using OR (|).
Definition at line 172 of file qvmplayercamera.h.
QVMPlayerCamera::QVMPlayerCamera | ( | QString | name = QString() |
) |
Constructs a QVMPlayerCamera, which is initially in "Closed" status.
Definition at line 447 of file qvmplayercamera.cpp.
References QVPropertyHolder::inputFlag, and QVPropertyHolder::outputFlag.
QVMPlayerCamera::~QVMPlayerCamera | ( | ) |
Destroys a QVMPlayerCamera.
Definition at line 474 of file qvmplayercamera.cpp.
References closeCam().
bool QVMPlayerCamera::openCam | ( | const QString & | url, | |
OpenOptions | opts = Default | |||
) |
Opens a mplayer source given by its URL.
url | URL of the mplayer source. Possible URLs are ([] means optional, {} means alternative): |
[file://path-to/]file{.avi,.mpg,.dv,...}
/home/user/video1.mpg ../video2.avi file:tmp/video3.dv
{http://,rtsp://,ftp://}www.domain.com/path-to/file{.avi,.mpg,.dv,...}
rtsp://ficheros.7rm.es/7RM/7rm06-01-071430.rm http://perception.inf.um.es/public_data/videos/futbol/Lorca-Ponferradina.avi ftp://user:passwd@server.dom/data/video.avi
{dvd://,vcd://}...
dvd://2 vcd://1
mf://path-to/filemask{.jpg,.png}
mf:///home/user/images/img*.jpg mf:///./images/img*.png
{v4l,v4l2,analog}://{device file}?[options]
v4l:///dev/video0
analog:///dev/video0?height=480&width=640&brightness=-100
r
and c
parameters (see overloaded function). Check manual page for mplayer, for a complete list of options, at parameter '-tv' option specifications.
opts | Or'ed set of opening options (see QVMPlayerCamera::OpenOption). |
Definition at line 658 of file qvmplayercamera.cpp.
References openCam().
Referenced by getFrame().
bool QVMPlayerCamera::openCam | ( | const QString & | urlstring, | |
unsigned int | r, | |||
unsigned int | c, | |||
OpenOptions | opts = Default | |||
) |
Opens a mplayer source given by its URL, and scales output to a requested size.
(Overloaded function, provided by convenience).
url | Camera URL (see QVMPlayerCamera::openCam(const QString&,OpenOptions)) | |
r | Number of requested output rows. | |
c | Number of requested output cols. | |
opts | Camera opening options (see QVMPlayerCamera::openCam(const QString&,OpenOptions)) |
bool QVMPlayerCamera::openCam | ( | ) |
Opens a mplayer source using the internal properties assigned to it. (Overloaded function, provided by convenience; see QVPropertyHolder for details on properties). Used properties:
Definition at line 637 of file qvmplayercamera.cpp.
References Default, and RGBMEncoder.
Referenced by openCam().
bool QVMPlayerCamera::grab | ( | QVImage< uChar, 3 > & | image | ) |
Grabs a frame in RGB format.
If the camera is not opened with RGBMencoderMode option, this function will set param QVImage to null image.
image | QVImage that will store grabbed frame. |
Definition at line 906 of file qvmplayercamera.cpp.
Referenced by getFrame().
bool QVMPlayerCamera::grab | ( | QVImage< uChar, 1 > & | image | ) |
Grabs a gray scale frame.
If the camera is opened with RGBMencoderMode option, this function will set param QVImage to null image.
image | QVImage that will store grabbed frame. |
Definition at line 923 of file qvmplayercamera.cpp.
bool QVMPlayerCamera::grab | ( | QVImage< uChar > & | imgY, | |
QVImage< uChar > & | imgU, | |||
QVImage< uChar > & | imgV | |||
) |
Grabs a frame in YUV format.
This function grabs the image in YUV format, storing each channel Y, U and V, in a separate QVImage of one channel. YUV format would be 422, thus QVImage corresponding to plane Y will be four times bigger than those corresponding to planes U and V.
If the camera is opened with RGBMencoderMode option, this function will set param QVImage's to null images.
imgY | QVImage that will store grabbed frame Y channel. | |
imgU | QVImage that will store grabbed frame U channel. | |
imgV | QVImage that will store grabbed frame V channel. |
Definition at line 882 of file qvmplayercamera.cpp.
const QString QVMPlayerCamera::getUrlBase | ( | ) | const [inline] |
Returns the current camera name (without path).
Definition at line 277 of file qvmplayercamera.h.
OpenOptions QVMPlayerCamera::getOptions | ( | ) | const [inline] |
Returns current camera options.
Definition at line 281 of file qvmplayercamera.h.
int QVMPlayerCamera::getBufferSize | ( | ) | const [inline] |
Returns the current frame buffer size.
Definition at line 285 of file qvmplayercamera.h.
unsigned int QVMPlayerCamera::getFramesUpdated | ( | ) | const [inline] |
Returns the total number of updated frames.
Definition at line 289 of file qvmplayercamera.h.
unsigned int QVMPlayerCamera::getRows | ( | ) | const [inline] |
Returns the number of rows of the buffer.
Definition at line 293 of file qvmplayercamera.h.
unsigned int QVMPlayerCamera::getCols | ( | ) | const [inline] |
Returns the number of cols of the buffer.
Definition at line 297 of file qvmplayercamera.h.
double QVMPlayerCamera::getFPS | ( | ) | const [inline] |
Returns the camera speed in frames per second.
Definition at line 301 of file qvmplayercamera.h.
double QVMPlayerCamera::getTimeLength | ( | ) | const [inline] |
Returns the video file length in seconds.
Definition at line 305 of file qvmplayercamera.h.
double QVMPlayerCamera::getTimePos | ( | ) | const [inline] |
Returns the current video position in seconds.
Definition at line 309 of file qvmplayercamera.h.
double QVMPlayerCamera::getSpeed | ( | ) | const [inline] |
Returns the current video speed.
Definition at line 313 of file qvmplayercamera.h.
unsigned int QVMPlayerCamera::getFramesGrabbed | ( | ) | const [inline] |
Returns number of frames grabbed.
Definition at line 317 of file qvmplayercamera.h.
unsigned int QVMPlayerCamera::getFramesRead | ( | ) | const [inline] |
Returns number of frames read.
Definition at line 321 of file qvmplayercamera.h.
bool QVMPlayerCamera::isLiveCamera | ( | ) | const [inline] |
Tells if the camera is a live camera.
Definition at line 325 of file qvmplayercamera.h.
static bool QVMPlayerCamera::getFrame | ( | const QString | uri, | |
QVImage< uChar, 3 > & | img, | |||
int | frame = 0 | |||
) | [inline, static] |
Grabs a RGB image, from a camera specified with an URI.
This function grabs a frame from a video file or url, in RGB format, without having to create explicitly a mplayer camera object, open it, skip frames to the desired, and close the camera.
uri | Camera URL (see QVMPlayerCamera::openCam(const QString&,OpenOptions)). | |
image | QVImage that will store grabbed frame. | |
frame | frame number, 0 for first frame. |
Definition at line 335 of file qvmplayercamera.h.
References closeCam(), grab(), openCam(), and RGBMEncoder.
static bool QVMPlayerCamera::getFrame | ( | const QString | uri, | |
QVImage< uChar, 1 > & | img, | |||
int | frame = 0 | |||
) | [inline, static] |
Grabs a gray image, from a camera specified with an URI.
This function grabs a gray scale frame from a video file or url, without having to create explicitly a mplayer camera object, open it, skip frames to the desired, and close the camera.
uri | Camera URL (see QVMPlayerCamera::openCam(const QString&,OpenOptions)). | |
image | QVImage that will store grabbed frame. | |
frame | frame number, 0 for first frame. |
Definition at line 355 of file qvmplayercamera.h.
References closeCam(), Default, grab(), and openCam().
static bool QVMPlayerCamera::getFrame | ( | const QString | uri, | |
QVImage< uChar > & | imgY, | |||
QVImage< uChar > & | imgU, | |||
QVImage< uChar > & | imgV, | |||
int | frame = 0 | |||
) | [inline, static] |
Grabs a YUV image, from a camera specified with an URI.
This function grabs a frame from a video file or url, in YUV format, without having to create explicitly a mplayer camera object, open it, skip frames to the desired, and close the camera.
uri | Camera URL (see QVMPlayerCamera::openCam(const QString&,OpenOptions)). | |
imgY | QVImage that will store grabbed frame Y channel. | |
imgU | QVImage that will store grabbed frame U channel. | |
imgV | QVImage that will store grabbed frame V channel. | |
frame | frame number, 0 for first frame. |
Definition at line 380 of file qvmplayercamera.h.
References closeCam(), Default, grab(), and openCam().
bool QVMPlayerCamera::grab | ( | ) | [slot] |
Grabs a frame from camera input.
Grabs an image, and stores it in the corresponding properties of the camera: "RGB image", "Y channel image", "U channel image", and "V channel image".
image | QVImage that will store grabbed frame. |
Definition at line 853 of file qvmplayercamera.cpp.
References QVPropertyHolder::writeOutputProperties().
Referenced by link().
void QVMPlayerCamera::pauseCam | ( | ) | [slot] |
Pauses the camera.
Definition at line 1003 of file qvmplayercamera.cpp.
void QVMPlayerCamera::unpauseCam | ( | ) | [slot] |
Unpauses the camera.
Definition at line 1011 of file qvmplayercamera.cpp.
void QVMPlayerCamera::nextFrameCam | ( | ) | [slot] |
Go to the next frame.
Definition at line 1019 of file qvmplayercamera.cpp.
void QVMPlayerCamera::setSpeedCam | ( | double | d | ) | [slot] |
Set the camera speed.
d | Camera speed (as a multiplier of the FPS) |
Definition at line 1027 of file qvmplayercamera.cpp.
void QVMPlayerCamera::seekCam | ( | QVCamera::TSeekType | type, | |
double | pos | |||
) | [slot] |
Moves the camera file to a given position.
type | Type of seek: Current=0,Percentage=1,Absolute=2. | |
pos |
|
void QVMPlayerCamera::closeCam | ( | ) | [slot] |
Closes the camera.
Definition at line 799 of file qvmplayercamera.cpp.
Referenced by getFrame(), and ~QVMPlayerCamera().