Image IO
Centre for Vision, Speech & Signal Processing
DEVELOP LIBRARIES AMMA SEARCH AMMA HOME
 

Image Input and Output

AMMA now includes a comprehensive mechanism for reading and writing objects from and to files in a uniform and transparent fashion. It is based around two global functions: Load and Save. In particular, there is a set of routines to handle a variety of image file formats, together with the ability to convert between several different pixel representations.

The generic load/save mechanism is described here. In order to invoke the libraries specific to image I/O, you need to:

Hopefully some of this paraphernalia will not be necessary in the future...

The generic load/save call can then be used in the usual way, either by declaring the namespace:

ImageC<RealT> im;
using namespace StdIO;
Load ("fred.pgm", im);
or prepending it to the function call:
StdIO::Load ("fred.pgm", im);
For an example of how to use the system with images see exImgIO.cc. (Remember: to compile this example you'll need the "DPImageIO" library.)

To find what file formats and conversions are available, use the /vol/vssp/local/amma/bin/conv tool, with the following options:

-lf - list all known file formats
-lc - list all known conversions
-lt - list all known classes (?)

Creating image converters

If you wish to load and save your own image type as ppm, pgm or any other file format that is already supported, and the particular conversion you want is not currently available, it is straightforward to add one to the collection (currently in Image/DPImageIO/ImgTypeCnv.cc). Following is an example for converting a byte image into a double image. For more information on writing converters see Basic Types.IO

ImageC< DoubleImageValueT> DPConvByteImageCT2DoubleImageCT(const ImageC< ByteGreyValueT> &dat)  
{ 
  ImageC< DoubleImageValueT> ret(dat.Rectangle());
  for(Image2IterC< DoubleImageValueT,ByteGreyValueT> it(ret,dat);it.IsElm();it.Next()) 
    it.Data1() = (DoubleImageValueT) it.Data2();
  return ret;
}

DP_REGISTER_CONVERTION(ByteImageCT2DoubleImageCT, 1);
The argument in the function call indicates (as a ratio of the number of bytes in the respective pixels) the amount of information lost in the conversion. In this example, no information is lost, so the ratio is 1. For double to char conversion, the ration would be 8.

Subtopics:

    AMMA
        Image
            Image IO

Classes:

Default Classes Description
DPImageIOPNMBaseC PNM Utilities
DPIImagePNMByteRGBBodyC Load a PPM image.
DPOImagePNMByteRGBBodyC Save a ByteRGB image.
DPIImagePNMByteGreyBodyC Load a pgm image.
DPOImagePNMByteGreyBodyC Save a pgm image.
DPIImagePNMByteRGBC Load a RGB image in PPM format.
DPOImagePNMByteRGBC Save a RGB image in PPM format.
DPIImagePNMByteGreyC Load a byte image in PGM format.
DPOImagePNMByteGreyC Save a byte image in PGM format.
FileFormatPGMBodyC PGM File format information.
FileFormatPPMBodyC PPM File format information.
FileFormatPBMBodyC PGM File format information.
FileFormatPPMC Create an instance of a PPM File Format.
FileFormatPGMC Create an instance of a PGM File Format.
FileFormatPBMC Create an instance of a PGM File Format.
DPIImageJPegByteRGBC Load a RGB image in JPEG format.
DPOImageJPegByteRGBC Save a RGB image in JPEG format.
DPIImageJPegByteYUVC Load a YUV image in JPEG format.
DPOImageJPegByteYUVC Save a YUV image in JPEG format.
DPIImageJPegByteGreyC Load a Grey image in JPEG format.
DPOImageJPegByteGreyC Save a Grey image in JPEG format.
DPImageIOJPegBaseC::my_error_mgr Destructor.
DPImageIOJPegBaseC JPeg Utilities
DPImageIOJPegIBaseC
DPImageIOJPegOBaseC
DPIImageJPegBodyC Load a PPM image.
DPOImageJPegBodyC Save a image.
DPIImagePNGByteRGBC Load a RGB image in PPM format.
DPOImagePNGByteRGBC Save a RGB image in PPM format.
DPIImagePNGByteGreyC Load a RGB image in PPM format.
DPOImagePNGByteGreyC Save a RGB image in PPM format.
FileFormatJPEGBodyC JPEG File format information.
FileFormatJPEGC Create an instance of a JPEG File Format.
DPImageIOPNGBaseC PNG Utilities
DPIImageIOPNGBaseC
DPOImageIOPNGBaseC
DPIImagePNGBodyC Load a PPM image.
DPOImagePNGBodyC Save a image.
DPIImagePNGC Load a RGB image in PPM format.
DPOImagePNGC Save a RGB image in PPM format.
FileFormatPNGBodyC PNG File format information.
FileFormatPNGC Create an instance of a PNG File Format.
DPIImageTIFFByteRGBAC Load a RGB image in PPM format.
DPOImageTIFFByteRGBAC Save a RGB image in PPM format.
DPImageIOTIFFBaseC TIFF Utilities
DPIImageTIFFByteRGBABodyC Load a RGBA image.
DPOImageTIFFByteRGBABodyC Save a ByteRGBA image.
FileFormatTIFFBodyC TIFF File format information.
FileFormatTIFFC Create an instance of a TIFF File Format.
DPImageCifBaseBodyC Basic information about a cif file
DPIImageCifBodyC Load a YUV image in Cif format.
DPOImageCifBodyC Save a YUV image in Cif format.
DPIImageCifC Load a YUV image in Cif format.
DPOImageCifC Save a YUV image in Cif format.
FileFormatCifBodyC Cif File format information.
FileFormatCifC Create an instance of a Cif File Format.
DPImageYUVBaseBodyC Basic information about a cif file
DPIImageYUVBodyC Load a YUV image in YUV format.
DPOImageYUVBodyC Save a YUV image in YUV format.
DPIImageYUVC Load a YUV image in YUV format.
DPOImageYUVC Save a YUV image in YUV format.
FileFormatYUVBodyC YUV File format information.
FileFormatYUVC Create an instance of a YUV File Format.
FileFormatSYUVBodyC YUV File format information.
FileFormatSYUVC Create an instance of a YUV File Format.
DPImageRGBBaseBodyC Basic information about a raw rgb file
DPIImageRGBBodyC Load a RGB image in raw RGB format.
DPOImageRGBBodyC Save a RGB image in raw RGB format.
DPIImageRGBC Load a RGB image in RGB format.
DPOImageRGBC Save a RGB image in raw RGB format.
FileFormatRGBBodyC RGB File format information.
FileFormatRGBC Create an instance of a RGB File Format.
FileFormatRawBodyC raw File format information.
FileFormatRawC Create an instance of a RGB File Format.
IPSubSampleBodyC
IPSubSampleC
FileFormatMeteor1BodyC Meteor1 File format information.
FileFormatMeteor1C Create an instance of a Meteor1 File Format.
DPIImageBaseMeteor1BodyC Base class for Meteor1 frame grabbers.
DPIImageMeteor1BodyC Meteor1 frame grabber.
DPIImageMeteor1C Meteor1 frame grabber.
ByteBGRXValueC Integer BGRX colour value.
DPIImagePSByteRGBC Load a RGB image in PPM format.
DPOImagePSByteRGBC Save a RGB image in PPM format.
DPIImagePSByteGreyC Load a Grey image in PPM format.
DPOImagePSByteGreyC Save a Grey image in PPM format.
DPIImagePSByteRGBBodyC Load a Postscipt image.
DPOImagePSByteRGBBodyC Save a ByteRGB image.
DPIImagePSByteGreyBodyC Load a Postscipt image.
DPOImagePSByteGreyBodyC Save a ByteGrey image.
DPIImagePSLine2dPPC Load a RGB image in PPM format.
DPOImagePSLine2dPPC Save a RGB image in PPM format.
FileFormatPSBodyC PS File format information. (For images.)
FileFormatPSC Create an instance of a PS File Format.
DPIImagePSLine2dPPBodyC Load a PPM image.
DPOImagePSLine2dPPBodyC Save a Line2dPP image.

Executables:

Executables Description
conv File/Sequence convertion.
Author: Charles Galambos, Bill Christmas, Generated by DocEntry: March 20, 2001