libcvd
Classes | Public Types | Public Member Functions | List of all members
CVD::Image< T > Class Template Reference

A full image which manages its own data. More...

#include <image.h>

Inheritance diagram for CVD::Image< T >:
Inheritance graph
[legend]
Collaboration diagram for CVD::Image< T >:
Collaboration graph
[legend]

Public Types

typedef T value_type
 The data type of the pixels in the image.
 

Public Member Functions

Imagecopy_from (const SubImage< T > &other)
 
 Image (const SubImage< T > &i)
 Copy-ish constructor: new allocation and copy the data. More...
 
 Image (const Image &i)
 Copy constructor: new allocation and copy the data. More...
 
 Image (Image &&move_from)
 Move constructor: steal the pointer.
 
Imageoperator= (const Image &i)
 Copy the data. More...
 
Imageoperator= (Image &&move_from)
 
template<class C >
const Imageoperator= (Internal::ImagePromise< C > p)
 
template<class C >
 Image (Internal::ImagePromise< C > p)
 
 Image ()
 Default constructor: everything set to zero.
 
 Image (const ImageRef &size)
 Create an empty image of a given size. More...
 
 Image (const ImageRef &size, const T &val)
 Create a filled image of a given size. More...
 
void resize (const ImageRef &size)
 Resize the image (destroying the data). More...
 
void resize (const ImageRef &size, const T &val)
 Resize the image (destroying the data). More...
 
 ~Image ()
 The destructor removes the image data.
 
- Public Member Functions inherited from CVD::BasicImage< C >
virtual ~BasicImage ()
 The image data is not destroyed when a BasicImage is destroyed.
 
ConstPointerType data () const
 Returns the raw image data.
 
PointerType data ()
 Returns the raw image data.
 
void copy_from (const BasicImage< C > &other)
 
ImageRef size () const
 What is the size of this image?
 
void zero ()
 Set image data to all zero bytes. More...
 
void fill (const C d)
 Set all the pixels in the image to a value. More...
 
 BasicImage (const BasicImage &copyof)=default
 Copy constructor. More...
 
BasicImageoperator= (const BasicImage &copyof)=default
 Assignment operator. More...
 
- Public Member Functions inherited from CVD::Internal::ImageData< C >
 ImageData (const ImageData &)=default
 
 ImageData (void *data, size_t len, ImageRef sz)
 
 ImageData (void *data, ImageRef sz)
 
ImageDataoperator= (const ImageData &)=default
 
size_t datalength () const
 What is the row stride of the image?
 

Additional Inherited Members

- Protected Types inherited from CVD::Internal::ImageData< C >
using PointerType = void *
 
using ConstPointerType = const void *
 
- Protected Attributes inherited from CVD::Internal::ImageData< C >
void * my_data
 
ImageRef my_size
 
size_t data_length
 

Detailed Description

template<class T>
class CVD::Image< T >

A full image which manages its own data.

Parameters
TThe pixel type for this image. Typically either CVD::byte or CVD::Rgb<CVD::byte> > are used, but images could be constructed of any available type.

The images behave much like 2D STL vectors. Iterators iterate over the pixels.

Loading and saving, format conversion and some copying functionality is provided by external functions rather than as part of this class. See the Image loading and saving, and format conversion module for documentation of these functions.

Constructor & Destructor Documentation

◆ Image() [1/4]

template<class T>
CVD::Image< T >::Image ( const SubImage< T > &  i)
inline

Copy-ish constructor: new allocation and copy the data.

Parameters
copyThe image to copy

◆ Image() [2/4]

template<class T>
CVD::Image< T >::Image ( const Image< T > &  i)
inline

Copy constructor: new allocation and copy the data.

Parameters
copyThe image to copy

◆ Image() [3/4]

template<class T>
CVD::Image< T >::Image ( const ImageRef size)
inline

Create an empty image of a given size.

Parameters
sizeThe size of image to create

◆ Image() [4/4]

template<class T>
CVD::Image< T >::Image ( const ImageRef size,
const T &  val 
)
inline

Create a filled image of a given size.

Parameters
sizeThe size of image to create
valThe value to fill the image with

Member Function Documentation

◆ operator=()

template<class T>
Image& CVD::Image< T >::operator= ( const Image< T > &  i)
inline

Copy the data.

Parameters
copyofThe image to copy

◆ resize() [1/2]

template<class T>
void CVD::Image< T >::resize ( const ImageRef size)
inline

Resize the image (destroying the data).

Parameters
sizeThe new size of the image

◆ resize() [2/2]

template<class T>
void CVD::Image< T >::resize ( const ImageRef size,
const T &  val 
)
inline

Resize the image (destroying the data).

Parameters
sizeThe new size of the image
valThe value to fill the image with

The documentation for this class was generated from the following file: