PARP Research Group University of Murcia, Spain


Video and image input/storage group

Classes and functions to perform image an video input, and storage in image and video files. More...

Classes

class  QVMPlayerCamera
 Video source class for reading many video file formats, webcams and digital cameras. More...
class  QVVideoRecorder
 Video source class for reading many video file formats, webcams and digital cameras. More...

Functions

bool writeYUV4MPEG2Header (QFile &file, const int cols, const int rows, const int fps)
 Create a yuv4mpeg2 video file.
bool writeYUV4MPEG2Frame (QFile &file, const QVImage< uChar, 1 > imageY, const QVImage< uChar, 1 > imageU, const QVImage< uChar, 1 > imageV)
 Write YUV image frames to a yuv4mpeg2 video file.
bool writeYUV4MPEG2Frame (QFile &file, const QVImage< uChar, 3 > imageRGB)
 Write RGB image frames to a yuv4mpeg2 video file.
bool writeQVImageToFile (const QString fileName, const QVImage< uChar, 3 > &image)
 Write the content of a QVImage object in an image file.
bool readQVImageFromFile (const QString fileName, QVImage< uChar, 3 > &image)
 Reads the content of a QVImage object from an image file.

Detailed Description

Classes and functions to perform image an video input, and storage in image and video files.


Function Documentation

bool readQVImageFromFile ( const QString  fileName,
QVImage< uChar, 3 > &  image 
)

Reads the content of a QVImage object from an image file.

Todo:
Document this
Parameters:
fileName The name of the image file to read from. File format is inferred from fileName suffix. Supported formats: BMP,JPG,PNG,PPM,TIFF,XBM,XPM,GIF,PBM,PGM.
image The image to store in the file.
Returns:
TRUE if success, FALSE otherwise.

Definition at line 80 of file qvio.cpp.

bool writeQVImageToFile ( const QString  fileName,
const QVImage< uChar, 3 > &  image 
)

Write the content of a QVImage object in an image file.

Todo:
Document this
Parameters:
fileName The name of the image file to create. It is overwritten if already exists. File format is inferred from fileName suffix. Supported formats: BMP,JPG,PNG,PPM,TIFF,XBM,XPM.
image The image to store in the file.
Returns:
TRUE if success, FALSE otherwise.

Definition at line 77 of file qvio.cpp.

bool writeYUV4MPEG2Frame ( QFile &  file,
const QVImage< uChar, 3 >  imageRGB 
)

Write RGB image frames to a yuv4mpeg2 video file.

This function stores a frame in a video file from the RGB format. The parameter of this function is an image containing the RGB image. For further information about its usage, see documentation for function writeYUV4MPEG2Header.

Parameters:
file The input file object. It must be already opened when received as argument by this function.
imageRGB RGB image object, to store in the video file.
See also:
writeYUV4MPEG2Header

Definition at line 63 of file qvio.cpp.

bool writeYUV4MPEG2Frame ( QFile &  file,
const QVImage< uChar, 1 >  imageY,
const QVImage< uChar, 1 >  imageU,
const QVImage< uChar, 1 >  imageV 
)

Write YUV image frames to a yuv4mpeg2 video file.

This is an overloaded version of the function writeYUV4MPEG2Frame(QFile &, const QVImage<uChar,3>) provided for convenience.

This version stores a frame in a video file from the YUV format. The parameters of this function must be three images containing the three chanels for the YUV image. For further information about its usage, see documentation for function writeYUV4MPEG2Header.

Parameters:
file The input file object. It must be already opened when received as argument by this function.
imageY Image object containing the Y channel for the YUV image, to store in the video file.
imageU Image object containing the Y channel for the YUV image, to store in the video file.
imageV Image object containing the Y channel for the YUV image, to store in the video file.
See also:
writeYUV4MPEG2Header

Definition at line 48 of file qvio.cpp.

Referenced by QVVideoRecorder::iterate(), and writeYUV4MPEG2Frame().

bool writeYUV4MPEG2Header ( QFile &  file,
const int  cols,
const int  rows,
const int  fps 
)

Create a yuv4mpeg2 video file.

This function stores the header for a video sequence in YUV4MPEG2 format in a newly created file. It can be used in conjunction with any of the versions of the writeYUV4MPEG2Frame functions to store a flow of images in a video file.

The following code illustrates its usage. First the video file must be created and initializated with a header:

#include <QFile>

[...]
QFile videoFile("test.mpeg");
videoFile.open(QIODevice::WriteOnly|QIODevice::Truncate);
writeYUV4MPEG2Header(videoFile, cols, rows, 24);
[...]

Then, each image frame must be stored in the video file, until a stop condition:

while(newImages)
        {
        // Read a new image in RGB format
        QVImage<uChar,3> rgbImage = getNewRGBImage();
        
        // Write the RGB image to the file
        writeYUV4MPEG2Frame(videoFile, rgbImage);
        [...]
        }

Alternatively, an overloaded version of the writeYUV4MPEG2Frame function can be used, to store an image in YUV format:

while(newImages)
        {
        // Read a new YUV image in 4:2:0 format
        QVImage<uChar,1> yImage = getNewYUVImageYChannel();
        QVImage<uChar,1> UImage = getNewYUVImageUChannel();
        QVImage<uChar,1> VImage = getNewYUVImageVChannel();

        // Write the YUV image to the file
        writeYUV4MPEG2Frame(videoFile, yImage, uImage, vImage);
        [...]
        }

when finished storing frames in the video file, it can be closed

videoFile.close();

Parameters:
file The input file object. It must be already opened when received as argument by this function.
cols The number of columns that the video in the file should have.
rows The number of rows that the video in the file should have.
fps The number of frames per second that the video sequence will have.
See also:
writeYUV4MPEG2Frame(QFile &, const QVImage<uChar,1>, const QVImage<uChar,1>, const QVImage<uChar,1>);

writeYUV4MPEG2Frame(QFile &, const QVImage<uChar,3>);

Definition at line 41 of file qvio.cpp.

Referenced by QVVideoRecorder::iterate().




QVision framework. PARP research group, copyright 2007, 2008.