Image loading and saving, and format conversion

Classes

struct  CVD::Pixel::DefaultConvertible< C >
struct  CVD::IsConvertible< In, Out >
class  CVD::Parameter< C >
struct  CVD::PixelByPixelConvertible< In, Out >

Functions

template<class D , class C >
Image< D > CVD::convert_image (const BasicImage< C > &from)
template<class D , class Conv , class C >
Image< D > CVD::convert_image (const SubImage< C > &from)
template<>
void CVD::convert_image (const BasicImage< vuy422 > &from, BasicImage< byte > &to)
template<>
void CVD::convert_image (const BasicImage< vuy422 > &from, BasicImage< Rgb< byte > > &to)
template<>
void CVD::convert_image (const BasicImage< yuv422 > &from, BasicImage< byte > &to)
template<>
void CVD::convert_image (const BasicImage< yuv422 > &from, BasicImage< Rgb< byte > > &to)
template<>
void CVD::convert_image (const BasicImage< yuv411 > &from, BasicImage< byte > &to)
template<>
void CVD::convert_image (const BasicImage< yuv411 > &from, BasicImage< Rgb< byte > > &to)
template<>
void CVD::convert_image (const BasicImage< bayer_bggr16be > &from, BasicImage< Rgb< unsigned short > > &to)
template<>
void CVD::convert_image (const BasicImage< bayer_bggr16be > &from, BasicImage< unsigned short > &to)
template<>
void CVD::convert_image (const BasicImage< bayer_bggr16 > &from, BasicImage< Rgb< unsigned short > > &to)
template<>
void CVD::convert_image (const BasicImage< bayer_bggr16 > &from, BasicImage< unsigned short > &to)
template<>
void CVD::convert_image (const BasicImage< bayer_bggr > &from, BasicImage< Rgb< byte > > &to)
template<>
void CVD::convert_image (const BasicImage< bayer_bggr > &from, BasicImage< byte > &to)
template<class D1 , class D2 , class C >
std::pair< Image< D1 >, Image
< D2 > > 
CVD::convert_image_pair (const BasicImage< C > &from)
template<>
std::pair< Image< byte >
, Image< Rgb< byte > > > 
CVD::convert_image_pair (const BasicImage< yuv411 > &from)
template<class S , class T >
void CVD::copy (const BasicImage< S > &in, BasicImage< T > &out, ImageRef size=ImageRef(-1,-1), ImageRef begin=ImageRef(), ImageRef dst=ImageRef())
template<class I >
void CVD::img_load (Image< I > &im, std::istream &i)
template<class PixelType >
void CVD::img_save (const BasicImage< PixelType > &im, std::ostream &o, ImageType::ImageType t, const std::map< std::string, Parameter<> > &p=std::map< std::string, Parameter<> >())
void CVD::output_eps_footer (std::ostream &o)
template<class PixelType >
void CVD::output_eps_header (std::ostream &o, const BasicImage< PixelType > &im)
void CVD::output_eps_header (std::ostream &o, const ImageRef &s)
void CVD::output_eps_header (std::ostream &o, int xs, int ys)
template<class PixelType >
void CVD::pnm_load (Image< PixelType > &im, std::istream &i)
template<class PixelType >
void CVD::pnm_save (const BasicImage< PixelType > &im, std::ostream &o)

Detailed Description

Functions to support saving and loading of BasicImage and Image to and from streams. Supports a few common file formats (autodetecting on loading). Also functions for perfoming type conversion as necessary.


Function Documentation

template<class D , class C >
Image<D> CVD::convert_image ( const BasicImage< C > &  from  )  [inline]

Convert an image from one type to another using the default.

Parameters:
D The destination image pixel type
C The source image pixel type
from The image to convert from

Definition at line 117 of file image_convert.h.

template<class D , class Conv , class C >
Image< D > CVD::convert_image ( const SubImage< C > &  from  )  [inline]

Convert an image from one type to another using a specified conversion.

Parameters:
D The destination image pixel type
C The source image pixel type
Conv The conversion to use
from The image to convert from

Definition at line 93 of file image_convert.h.

template<>
void CVD::convert_image ( const BasicImage< vuy422 > &  from,
BasicImage< byte > &  to 
) [inline]

Convert VUY 422 pixel data to Y only

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< vuy422 > &  from,
BasicImage< Rgb< byte > > &  to 
) [inline]

Convert VUY 422 pixel data to RGB

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< yuv422 > &  from,
BasicImage< byte > &  to 
) [inline]

Convert YUV 422 pixel data to Y only

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< yuv422 > &  from,
BasicImage< Rgb< byte > > &  to 
) [inline]

Convert YUV 422 pixel data to RGB

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< yuv411 > &  from,
BasicImage< byte > &  to 
) [inline]

Convert YUV 411 pixel data to Y only

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< yuv411 > &  from,
BasicImage< Rgb< byte > > &  to 
) [inline]

Convert YUV 411 pixel data to RGB

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< bayer_bggr16be > &  from,
BasicImage< Rgb< unsigned short > > &  to 
) [inline]

Convert 16bit big endian Bayer pattern of various forms to rgb data

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< bayer_bggr16be > &  from,
BasicImage< unsigned short > &  to 
) [inline]

Convert 16bit big endian Bayer pattern of various forms to greyscale data

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< bayer_bggr16 > &  from,
BasicImage< Rgb< unsigned short > > &  to 
) [inline]

Convert 16bit Bayer pattern of various forms to rgb data

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< bayer_bggr16 > &  from,
BasicImage< unsigned short > &  to 
) [inline]

Convert 16bit Bayer pattern of various forms to greyscale data

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< bayer_bggr > &  from,
BasicImage< Rgb< byte > > &  to 
) [inline]

Convert Bayer pattern of various forms to rgb data

Parameters:
from The input data
to The output data
template<>
void CVD::convert_image ( const BasicImage< bayer_bggr > &  from,
BasicImage< byte > &  to 
) [inline]

Convert Bayer pattern of various forms to greyscale data

Parameters:
from The input data
to The output data
template<class D1 , class D2 , class C >
std::pair<Image<D1>, Image<D2> > CVD::convert_image_pair ( const BasicImage< C > &  from  )  [inline]

Convert an image from one type to another using the default, returning a pair of images.

Parameters:
D1 The first destination image pixel type
D2 The second destination image pixel type
C The source image pixel type
from The image to convert from

Definition at line 133 of file image_convert.h.

template<>
std::pair<Image<byte>,Image<Rgb<byte> > > CVD::convert_image_pair ( const BasicImage< yuv411 > &  from  )  [inline]

Convert YUV 411 pixel data to both Y and RGB

Parameters:
from The input data
template<class S , class T >
void CVD::copy ( const BasicImage< S > &  in,
BasicImage< T > &  out,
ImageRef  size = ImageRef(-1,-1),
ImageRef  begin = ImageRef(),
ImageRef  dst = ImageRef() 
) [inline]

Generic image copy function for copying sub rectangles of images into other images. This performs pixel type conversion if the input and output images are different pixel types.

Parameters:
in input image to copy from
out output image to copy into
size size of the area to copy. By default this is the entirty of the input image
begin upper left corner of the area to copy, by default the upper left corner of the input image
dst upper left corner of the destination in the output image, by default the upper left corner of the output image
Exceptions:
ImageRefNotInImage if either begin is not in the input image or dst not in the output image

Definition at line 27 of file utility.h.

template<class I >
void CVD::img_load ( Image< I > &  im,
std::istream &  i 
) [inline]

Load an image from a stream. This function resizes the Image as necessary. It will also perform image type conversion (e.g. colour to greyscale) according the Pixel:CIE conversion.

Parameters:
I The pixel type of the image
im The image to receive the loaded image data
i The stream

Definition at line 219 of file image_io.h.

template<class PixelType >
void CVD::img_save ( const BasicImage< PixelType > &  im,
std::ostream &  o,
ImageType::ImageType  t,
const std::map< std::string, Parameter<> > &  p = std::map<std::string, Parameter<> >() 
) [inline]

Save an image to a stream. This function will convert types if necessary.

Parameters:
PixelType The pixel type of the image
Conversion The conversion class to use
im The image to save
o The stream
t The image file format to use (see ImageType::ImageType for a list of supported formats)

Definition at line 292 of file image_io.h.

void CVD::output_eps_footer ( std::ostream &  o  ) 

Outputs an EPS footer to an ostream

Parameters:
o the ostream
template<class PixelType >
void CVD::output_eps_header ( std::ostream &  o,
const BasicImage< PixelType > &  im 
) [inline]

Outputs an EPS header to an ostream. Typical use is to output the header, save a raw PS image, output some other PS (eg annotations) and the output the EPS footer.

Parameters:
o the ostream
im the image

Definition at line 410 of file image_io.h.

void CVD::output_eps_header ( std::ostream &  o,
const ImageRef &  s 
)

Outputs an EPS header to an ostream. Typical use is to output the header, save a raw PS image, output some other PS (eg annotations) and the output the EPS footer.

Parameters:
o the ostream
s size of the image
void CVD::output_eps_header ( std::ostream &  o,
int  xs,
int  ys 
)

Outputs an EPS header to an ostream. Typical use is to output the header, save a raw PS image, output some other PS (eg annotations) and the output the EPS footer.

Parameters:
o the ostream
xs the width of the image
ys the height of the image
template<class PixelType >
void CVD::pnm_load ( Image< PixelType > &  im,
std::istream &  i 
) [inline]

Load a PNM image from a stream. Deprecated Use img_load(Image<I>& im, std::istream& i) instead. This can handle and automatically detect other file formats as well.

Loading is simplistic, and automatic conversions of values are performed. So, for instance bytes are assumed to be in the range 0--255 and floats in the range 0--1, so loading bytes in to an Image<float> will result in an image with floats in the range 0--1. In the reverse direction, floats falling outside the range 0--1, will wrap when converted to bytes.

The image loader ignores the data range given by the file, if it is given.

Parameters:
PixelType The pixel type of the image
im The image
i The stream

Definition at line 371 of file image_io.h.

template<class PixelType >
void CVD::pnm_save ( const BasicImage< PixelType > &  im,
std::ostream &  o 
) [inline]

Save an image to a stream as a PNM. Deprecated Use img_save() instead, i.e. img_save(im, o, ImageType::PNM);

Parameters:
PixelType The pixel type of the image
im The image
o The stream

Definition at line 350 of file image_io.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libcvd
Author(s): Edward Rosten, Paul Smith, Tom Drummond, Gerhard Reitmayr, Ethan Eade, Timothy Gan, Chris Kemp, Georg Klein
autogenerated on Fri Jan 11 09:13:34 2013