User Documentation
RAVL, Recognition And Vision Library
DEVELOP HOME PAGE CLASS LIST CONTENTS
Ravl - Images - Video


  SUBTOPICS

Video Sequences

Sequences of images are handled in RAVL in a similar way to sequences of any other kind of object. Details of how streams work can be found in Ravl.OS.Sequence. The differences between image sequences and other RAVL sequences are

  • A variety of "standard" video formats are supported (see below). Where the data has a distinctive header (e.g. JPEG), this is used to determine the format; otherwise (e.g. the CIF family) the filename suffix is used.
  • Where there is a mismatch between the pixel types in file and image (for example when reading a CIF video file into ImageC<RGBValueC>), the appropriate conversion is automatically done.

Here's a summary of currently supported formats. (For an exhaustive list use the 'conv -lf' command.)

  • sqcif Binary byte YUV420 images, 72 by 88
  • qcif Binary byte YUV420 images, 144 by 176
  • cif Binary byte YUV420 images, 288 by 352
  • 4cif Binary byte YUV420 images, 576 by 704
  • 16cif Binary byte YUV420 images, 1152 by 1408
  • yuv Binary byte YUV images, 576 by 720
  • syuv Binary byte YUV images, 576 by 720 one image to a file.
  • rgb Binary byte RGB images, 242 by 360
  • rgb2 Binary byte RGB images, 288 by 384
  • frgb Binary byte RGB images, 484 by 720
  • frgb2 Binary byte RGB images, 576 by 768
  • jpeg The libjpeg libraries support the storage of a sequence of compressed images in a single file.
Note: In YUV420, the colour is sampled at half the resolution of the intensity in both dimensions.

Before you can do video IO there are a few things you have to do:

  • insert this header file:
    #include "Ravl/DP/SequenceIO.hh"
    	
  • add this library in the defs.mk:
    USESLIBS = RavlVideoIO ....
    	

Following is a example of how to use this mechanism to read and write a sequence of images.

Reading a sequence

    DPIPortC<ImageC<IntT>  > in;
    if(!OpenISequence(in,"myfile.cif")) {
      // Failed to open input file.
      // Report an error...
    }
    ImageC<IntT> value;
    while(in.Get(value)) { // Get next image, stop if none.
      
      ... Process your image...
      
    }
    

Writting a sequence

    DPOPortC<ImageC<IntT>  > out;
    if(!OpenOSequence(out,"myfile.cif")) {
      // Failed to open output file.
      // Report an error..
    }

    while(... more images to write ...) {
      ImageC<IntT>  image; 
     
      ... Generate your images ....
      
      out.Put(image);
    } 
    

Advanced classes:

 DPOMultiVidCMulti-view video sequence output port
Documentation by CxxDoc: Tue Aug 13 10:00:52 2002