refinery
RAW file processor
Public Member Functions

refinery::ImageReader Class Reference

Returns Image instances based on stream input and Exif data. More...

#include <refinery/unpack.h>

List of all members.

Public Member Functions

GrayImagereadGrayImage (std::streambuf &istream, const ExifData &exifData)
 Reads and returns a GrayImage.
GrayImagereadGrayImage (FILE *istream, const ExifData &exifData)
 Reads and returns a GrayImage.
RGBImagereadRgbImage (std::streambuf &istream, const ExifData &exifData)
 Reads and returns an RGBImage.
RGBImagereadRgbImage (FILE *istream, const ExifData &exifData)
 Reads and returns an RGBImage.

Detailed Description

Returns Image instances based on stream input and Exif data.

When reading is done, the stream will be seeked one byte past the last byte in the image.

You must know ahead of time whether the input image is grayscale or RGB. This can be calculated using Exif data. Most modern cameras use Bayer filter arrays over monochrome sensors and so they are grayscale, not RGB.

Here's what you can do to create a GrayImage:

 std::filebuf file;
 file.open("image.NEF", std::ios::in);
 refinery::DcrawExifData exifData(file);
 refinery::ImageReader reader;
 std::auto_ptr<GrayImage*> grayImage(
   reader.readGrayImage(file, exifData));
Examples:

util/raw2ppm.cc.

Definition at line 39 of file unpack.h.


Member Function Documentation

GrayImage* refinery::ImageReader::readGrayImage ( std::streambuf &  istream,
const ExifData exifData 
)

Reads and returns a GrayImage.

Parameters:
[in]istreamInput streambuf, such as an std::filebuf.
[in]exifDataImage Exif data.
Returns:
A newly-allocated GrayImage which the caller must free later.
Examples:
util/raw2ppm.cc.
GrayImage* refinery::ImageReader::readGrayImage ( FILE *  istream,
const ExifData exifData 
)

Reads and returns a GrayImage.

This doesn't use C++ streams, so it's suitable for language bindings.

Parameters:
[in]istreamInput file pointer.
[in]exifDataImage Exif data.
Returns:
A newly-allocated GrayImage which the caller must free later.
RGBImage* refinery::ImageReader::readRgbImage ( std::streambuf &  istream,
const ExifData exifData 
)

Reads and returns an RGBImage.

Aside from reading RAW files, this can read 8-bit or 16-bit PPM files.

Parameters:
[in]istreamInput streambuf, such as an std::filebuf.
[in]exifDataImage Exif data.
Returns:
A newly-allocated RGBImage which the caller must free later.
RGBImage* refinery::ImageReader::readRgbImage ( FILE *  istream,
const ExifData exifData 
)

Reads and returns an RGBImage.

Aside from reading RAW files, this can read 8-bit or 16-bit PPM files.

This doesn't use C++ streams, so it's suitable for language bindings.

Parameters:
[in]istreamInput file pointer.
[in]exifDataImage Exif data.
Returns:
A newly-allocated RGBImage which the caller must free later.

The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator