Image and video processing
The basic image class is the template class ImageC, often templated on one of
the pixel classes.
In terms of its structure and functionality, ImageC and its derivatives can
be considered as 2-D arrays. If there is a difference in philosophy between ImageC and Array2dC, it is that in ImageC there is a
sense of neighbourhood, and spatial extent. In particular an ImageC object
contains one or more "image rectangles" (ImageRectangleC). When an image is
constructed, it has one associated rectangle corresponding to the border of the
image. However other rectangles can also be attached, corresponding to
subimages; they can also be moved around the image. These can be useful for
spatial filtering and other neighbourhood operations.
Image IO:
There is a comprehensive I/O package within
RAVL, including image I/O. It can deal with a
large and expanding range of file formats.
Indexing images:
- Simple C-style indexing:
Simple image constructors [e.g. ImageC::ImageC(UIntT
rows, UIntT columns) ] will use a coordinate system whose origin is the top
left-hand pixel. However other coordinate systems are possible. For instance,
a spatial filtering operation using a 3x3 mask will typically produce an image
that is smaller than the original - the whole image border has shrunk by one
pixel. The coordinate system of the new image will be such that corresponding
pixels in the two images have the same coordinates. Hence the
coordinates of the top left-hand pixel of the old and new images will be
respectively (0,0) and (1,1). The programmer does not need to keep track of
these changes though - use the image
rectangle or the border member functions [ImageC::TRow(), BRow(),
LCol() and RCol() ] to determine the image boundaries. It is recommended
to use IndexC, Index2dC for indexing images, as these have
division and modulo operators that behave sensibly for negative coordinates
(unlike int).
- Using RAVL image iterators:
The indexing philosophy just described can often be more compactly and
speedily implemented using the array iterator mechanism.
For an elementary example of its usage, look at the example in
Array2dIterC.
Normal classes:
Normal functions:
DrawFrame(Array2dC &,const DataT &,const IndexRange2dC &) | Draw a rectangle in an image. |
DrawLine(Array2dC &,const DataT &,const Index2dC &,const Index2dC &) | Draw a line in an image. |
DrawCross(Array2dC &,const DataT &,const Index2dC &,UIntT) | Draw a cross in an image. |
DrawCircle(Array2dC &,const DataT &,const Index2dC &,IntT) | Draw a circle in an image. |
|