libcvd
|
Functions to support saving and loading of BasicImage and Image to and from streams. More...
Classes | |
struct | CVD::IsConvertible< In, Out > |
Can two types be converted with CVD::convert_image? More... | |
struct | CVD::PixelByPixelConvertible< In, Out > |
Can individual pixels of two types be converted with ConvertPixels::convert()? E.g. More... | |
struct | CVD::Pixel::DefaultConvertible< C > |
All pixel types which are DefaultConvertible can be converted freely from one to another. More... | |
class | CVD::Parameter< C > |
Class for holding parameters for image savers, with type erasure. More... | |
Functions | |
template<> | |
void | CVD::convert_image (const BasicImage< bayer_bggr > &from, BasicImage< byte > &to) |
Convert Bayer pattern of various forms to greyscale data. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< bayer_bggr > &from, BasicImage< Rgb< byte >> &to) |
Convert Bayer pattern of various forms to rgb data. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< bayer_bggr16 > &from, BasicImage< unsigned short > &to) |
Convert 16bit Bayer pattern of various forms to greyscale data. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< bayer_bggr16 > &from, BasicImage< Rgb< unsigned short >> &to) |
Convert 16bit Bayer pattern of various forms to rgb data. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< bayer_bggr16be > &from, BasicImage< unsigned short > &to) |
Convert 16bit big endian Bayer pattern of various forms to greyscale data. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< bayer_bggr16be > &from, BasicImage< Rgb< unsigned short >> &to) |
Convert 16bit big endian Bayer pattern of various forms to rgb data. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< yuv422 > &from, BasicImage< Rgb< byte >> &to) |
Convert YUV 411 pixel data to RGB. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< yuv422 > &from, BasicImage< byte > &to) |
Convert YUV 422 pixel data to Y only. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< vuy422 > &from, BasicImage< Rgb< byte >> &to) |
Convert YUV 411 pixel data to both Y and RGB. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< vuy422 > &from, BasicImage< byte > &to) |
Convert VUY 422 pixel data to Y only. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< yuv420p > &from, BasicImage< Rgb< byte >> &to) |
Convert YUV420p pixel data to RGB. More... | |
template<> | |
void | CVD::convert_image (const BasicImage< yuv420p > &from, BasicImage< byte > &to) |
Convert YUV420p pixel data to Y only. More... | |
template<class D , class Conv , class C > | |
Image< D > | CVD::convert_image (const BasicImage< C > &from) |
Convert an image from one type to another using a specified conversion. More... | |
template<class D , class C > | |
Image< D > | CVD::convert_image (const BasicImage< C > &from) |
Convert an image from one type to another using the default. More... | |
template<class D1 , class D2 , class C > | |
std::pair< Image< D1 >, Image< D2 > > | CVD::convert_image_pair (const BasicImage< C > &from) |
Convert an image from one type to another using the default, returning a pair of images. More... | |
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<>>()) |
Save an image to a stream. More... | |
template<class PixelType > | |
void | CVD::pnm_save (const BasicImage< PixelType > &im, std::ostream &o) |
Save an image to a stream as a PNM. More... | |
template<class PixelType > | |
void | CVD::pnm_load (Image< PixelType > &im, std::istream &i) |
Load a PNM image from a stream. More... | |
void | CVD::output_eps_footer (std::ostream &o) |
Outputs an EPS footer to an ostream. More... | |
void | CVD::output_eps_header (std::ostream &o, int xs, int ys) |
Outputs an EPS header to an ostream. More... | |
void | CVD::output_eps_header (std::ostream &o, const ImageRef &s) |
Outputs an EPS header to an ostream. More... | |
template<class PixelType > | |
void | CVD::output_eps_header (std::ostream &o, const BasicImage< PixelType > &im) |
Outputs an EPS header to an ostream. More... | |
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()) |
Generic image copy function for copying sub rectangles of images into other images. More... | |
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.
void CVD::convert_image | ( | const BasicImage< bayer_bggr > & | from, |
BasicImage< byte > & | to | ||
) |
Convert Bayer pattern of various forms to greyscale data.
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< bayer_bggr > & | from, |
BasicImage< Rgb< byte >> & | to | ||
) |
Convert Bayer pattern of various forms to rgb data.
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< bayer_bggr16 > & | from, |
BasicImage< unsigned short > & | to | ||
) |
Convert 16bit Bayer pattern of various forms to greyscale data.
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< bayer_bggr16 > & | from, |
BasicImage< Rgb< unsigned short >> & | to | ||
) |
Convert 16bit Bayer pattern of various forms to rgb data.
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< bayer_bggr16be > & | from, |
BasicImage< unsigned short > & | to | ||
) |
Convert 16bit big endian Bayer pattern of various forms to greyscale data.
from | The input data |
to | The output data |
Image< D > CVD::convert_image | ( | const BasicImage< C > & | from | ) |
Convert an image from one type to another using a specified conversion.
D | The destination image pixel type |
C | The source image pixel type |
Conv | The conversion to use |
from | The image to convert from |
void CVD::convert_image | ( | const BasicImage< bayer_bggr16be > & | from, |
BasicImage< Rgb< unsigned short >> & | to | ||
) |
Convert 16bit big endian Bayer pattern of various forms to rgb data.
from | The input data |
to | The output data |
Image<D> CVD::convert_image | ( | const BasicImage< C > & | from | ) |
Convert an image from one type to another using the default.
D | The destination image pixel type |
C | The source image pixel type |
from | The image to convert from |
void CVD::convert_image | ( | const BasicImage< yuv422 > & | from, |
BasicImage< Rgb< byte >> & | to | ||
) |
Convert YUV 411 pixel data to RGB.
from | The input data |
to | The output dataConvert YUV 411 pixel data to Y only |
from | The input data |
to | The output dataConvert YUV 422 pixel data to RGB |
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< yuv422 > & | from, |
BasicImage< byte > & | to | ||
) |
Convert YUV 422 pixel data to Y only.
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< vuy422 > & | from, |
BasicImage< Rgb< byte >> & | to | ||
) |
Convert YUV 411 pixel data to both Y and RGB.
from | The input dataConvert VUY 422 pixel data to RGB |
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< vuy422 > & | from, |
BasicImage< byte > & | to | ||
) |
Convert VUY 422 pixel data to Y only.
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< yuv420p > & | from, |
BasicImage< Rgb< byte >> & | to | ||
) |
Convert YUV420p pixel data to RGB.
from | The input data |
to | The output data |
void CVD::convert_image | ( | const BasicImage< yuv420p > & | from, |
BasicImage< byte > & | to | ||
) |
Convert YUV420p pixel data to Y only.
from | The input data |
to | The output data |
std::pair<Image<D1>, Image<D2> > CVD::convert_image_pair | ( | const BasicImage< C > & | from | ) |
Convert an image from one type to another using the default, returning a pair of images.
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 |
void CVD::copy | ( | const BasicImage< S > & | in, |
BasicImage< T > & | out, | ||
ImageRef | size = ImageRef(-1, -1) , |
||
ImageRef | begin = ImageRef() , |
||
ImageRef | dst = ImageRef() |
||
) |
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.
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 |
ImageRefNotInImage | if either begin is not in the input image or dst not in the output image |
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<>>() |
||
) |
Save an image to a stream.
This function will convert types if necessary.
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) |
void CVD::output_eps_footer | ( | std::ostream & | o | ) |
Outputs an EPS footer to an ostream.
o | the ostream |
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.
o | the ostream |
xs | the width of the image |
ys | the height of the image |
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.
o | the ostream |
s | size of the image |
void CVD::output_eps_header | ( | std::ostream & | o, |
const BasicImage< PixelType > & | im | ||
) |
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.
o | the ostream |
im | the image |
void CVD::pnm_load | ( | Image< PixelType > & | im, |
std::istream & | i | ||
) |
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.
PixelType | The pixel type of the image |
im | The image |
i | The stream |
void CVD::pnm_save | ( | const BasicImage< PixelType > & | im, |
std::ostream & | o | ||
) |
Save an image to a stream as a PNM.
Deprecated Use img_save() instead, i.e. img_save(im, o, ImageType::PNM);
PixelType | The pixel type of the image |
im | The image |
o | The stream |