SLAMflex SE  0.1.0
SLAMflex provides detection and tracking of dominant planes for smartphone devices. This plane can then be used to show AR content relative to the plane orientation. The detection of plane is performed in the field of view of the smartphone camera. In subsequent frames it is tracked. The interface returns the plane position and orientation.
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CVD::Image< T > Class Template Reference

#include <image.h>

Inheritance diagram for CVD::Image< T >:
CVD::BasicImage< T > CVD::SubImage< T >

Classes

struct  CopyPlaceHolder
 

Public Member Functions

 Image (const Image &copy)
 
 Image (const CopyPlaceHolder &c)
 
CopyPlaceHolder copy_from_me () const
 
void copy_from (const BasicImage< T > &copy)
 
void copy_from (const SubImage< T > &copy)
 
void make_unique ()
 Make this image independent of any copies (i.e. force a copy of the image data). More...
 
const Imageoperator= (const Image &copyof)
 
template<class C >
const Imageoperator= (Internal::ImagePromise< C > p)
 
template<class C >
 Image (Internal::ImagePromise< C > p)
 
 Image ()
 Default constructor. More...
 
 Image (const ImageRef &size)
 
 Image (const ImageRef &size, const T &val)
 
 Image (const std::pair< ImageRef, T > &p)
 
void resize (const ImageRef &size)
 
void resize (const ImageRef &size, const T &val)
 
 ~Image ()
 The destructor removes the image data. More...
 
- Public Member Functions inherited from CVD::BasicImage< T >
 BasicImage (T *data, const ImageRef &size)
 
 BasicImage (const BasicImage &copyof)
 
void operator= (const BasicImage &copyof)
 
 ~BasicImage ()
 The image data is not destroyed when a BasicImage is destroyed. More...
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
- Public Member Functions inherited from CVD::SubImage< T >
 SubImage (T *data, const ImageRef &size, int stride)
 
bool in_image (const ImageRef &ir) const
 
bool in_image_with_border (const ImageRef &ir, int border) const
 
 ~SubImage ()
 The image data is not destroyed when a BasicImage is destroyed. More...
 
T & operator[] (const ImageRef &pos)
 
const T & operator[] (const ImageRef &pos) const
 
T * operator[] (int row)
 
const T * operator[] (int row) const
 
ImageRef pos (const T *ptr) const
 Given a pointer, this returns the image position as an ImageRef. More...
 
const T * data () const
 Returns the raw image data. More...
 
T * data ()
 Returns the raw image data. More...
 
iterator begin ()
 Returns an iterator referencing the first (top-left) pixel in the image. More...
 
const_iterator begin () const
 Returns a const iterator referencing the first (top-left) pixel in the image. More...
 
iterator end ()
 Returns an iterator pointing to one past the end of the image. More...
 
const_iterator end () const
 Returns a const iterator pointing to one past the end of the image. More...
 
void copy_from (const SubImage< T > &other)
 
ImageRef size () const
 What is the size of this image? More...
 
int row_stride () const
 What is the row stride of the image? More...
 
int totalsize () const
 What is the total number of elements in the image (i.e. size().x * size().y), including padding. More...
 
void zero ()
 Set all the pixels in the image to zero. This is a relatively fast operation, using memset. More...
 
void fill (const T d)
 
 SubImage (const SubImage &copyof)
 
SubImage sub_image (const ImageRef &start, const ImageRef &size)
 
const SubImage sub_image (const ImageRef &start, const ImageRef &size) const
 
SubImageref ()
 Return a reference to a SubImage. Useful for passing anonymous SubImages to functions. More...
 

Private Member Functions

void remove ()
 
void dup_from (const Image *copyof)
 

Private Attributes

int * num_copies
 

Additional Inherited Members

- Public Types inherited from CVD::BasicImage< T >
typedef T * iterator
 
typedef const T * const_iterator
 
- Public Types inherited from CVD::SubImage< T >
typedef SubImageIterator< T > iterator
 
typedef ConstSubImageIterator< T > const_iterator
 
- Protected Member Functions inherited from CVD::BasicImage< T >
 BasicImage ()
 The default constructor does nothing. More...
 
- Protected Member Functions inherited from CVD::SubImage< T >
T * end_ptr ()
 Return an off-the-end pointer without ever throwing AccessOutsideImage. More...
 
const T * end_ptr () const
 Return an off-the-end pointer without ever throwing AccessOutsideImage. More...
 
 SubImage ()
 
- Protected Attributes inherited from CVD::SubImage< T >
T * my_data
 The raw image data. More...
 
ImageRef my_size
 The size of the image. More...
 
int my_stride
 The row stride. More...
 

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.

Images do reference counting on the data, so multiple images can point to one block of data. This means that copying an image is like copying a pointer (so use the same care); to further the analogy, operator[]() dereferences images. Copy constructing is quite fast (a 16-byte copy and an increment), so images can be efficiently passed back in functions or used in containers like std::vector

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.

Definition at line 617 of file image.h.

Constructor & Destructor Documentation

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

Copy constructor. This does not copy the data, it just creates a new reference to the image data

Parameters
copyThe image to copy

Definition at line 629 of file image.h.

template<class T>
CVD::Image< T >::Image ( const CopyPlaceHolder c)
inline

CopyFrom" constructor. If constructed from this, it creates a new copy of the data. This provides symmetry with copy_from_me

Parameters
cThe (placeholder) image to copy from.

Definition at line 641 of file image.h.

template<class T>
template<class C >
CVD::Image< T >::Image ( Internal::ImagePromise< C >  p)
inline

Definition at line 703 of file image.h.

template<class T>
CVD::Image< T >::Image ( )
inline

Default constructor.

Definition at line 710 of file image.h.

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

Definition at line 717 of file image.h.

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

Definition at line 729 of file image.h.

template<class T>
CVD::Image< T >::Image ( const std::pair< ImageRef, T > &  p)
inline

Create a filled image of a given size

Parameters
pstd::pair<ImageRef, T> containing the size and fill value. Useful for creating containers of images with ImageCreationIterator

Definition at line 739 of file image.h.

template<class T>
CVD::Image< T >::~Image ( )
inline

The destructor removes the image data.

Definition at line 774 of file image.h.

Member Function Documentation

template<class T>
void CVD::Image< T >::copy_from ( const BasicImage< T > &  copy)
inline

Make a (new) copy of the image, also making a copy of the data

Parameters
copyThe image to copy

Definition at line 658 of file image.h.

template<class T>
void CVD::Image< T >::copy_from ( const SubImage< T > &  copy)
inline

Make a (new) copy of the image, also making a copy of the data

Parameters
copyThe image to copy

Definition at line 669 of file image.h.

template<class T>
CopyPlaceHolder CVD::Image< T >::copy_from_me ( ) const
inline

This returns a place holder from which an image can be constructed. On construction, a new copy of the data is made.

Definition at line 649 of file image.h.

template<class T>
void CVD::Image< T >::dup_from ( const Image< T > *  copyof)
inlineprivate

Definition at line 796 of file image.h.

template<class T>
void CVD::Image< T >::make_unique ( )
inline

Make this image independent of any copies (i.e. force a copy of the image data).

Definition at line 678 of file image.h.

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

Assign this image to another one. This does not copy the data, it just creates a new reference to the image data

Parameters
copyofThe image to copy

Definition at line 690 of file image.h.

template<class T>
template<class C >
const Image& CVD::Image< T >::operator= ( Internal::ImagePromise< C >  p)
inline

Definition at line 697 of file image.h.

template<class T>
void CVD::Image< T >::remove ( )
inlineprivate

Definition at line 785 of file image.h.

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

Resize the image (destroying the data). This does not affect any other images pointing to this data.

Parameters
sizeThe new size of the image

Definition at line 749 of file image.h.

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

Resize the image (destroying the data). This does not affect any other images pointing to this data.

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

Definition at line 763 of file image.h.

Member Data Documentation

template<class T>
int* CVD::Image< T >::num_copies
private

Definition at line 783 of file image.h.


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