Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
Public Types | Public Member Functions | Protected Attributes
iu::ImageCpu< PixelType, Allocator > Class Template Reference

Host 2D image class (pitched memory). More...

#include <image_cpu.h>

Inheritance diagram for iu::ImageCpu< PixelType, Allocator >:
iu::Image

Public Types

typedef PixelType pixel_type
 

Public Member Functions

 ImageCpu ()
 
virtual ~ImageCpu ()
 
 ImageCpu (unsigned int _width, unsigned int _height)
 
 ImageCpu (const iu::Size< 2 > &size)
 
 ImageCpu (PixelType *_data, unsigned int _width, unsigned int _height, size_t _pitch, bool ext_data_pointer=false)
 
PixelType * data (int ox=0, int oy=0)
 
const PixelType * data (int ox=0, int oy=0) const
 
PixelType getPixel (unsigned int x, unsigned int y)
 
PixelType * operator[] (unsigned int row)
 
virtual size_t bytes () const
 
virtual size_t pitch () const
 
virtual size_t stride () const
 
virtual unsigned int bitDepth () const
 
thrust::pointer< PixelType,
thrust::host_system_tag > 
begin (void)
 
thrust::pointer< PixelType,
thrust::host_system_tag > 
end (void)
 
virtual bool onDevice () const
 
ndarray_ref< PixelType, 2 > ref () const
 
 ImageCpu (const ndarray_ref< PixelType, 2 > &x)
 
 ImageCpu (boost::python::api::object &py_arr)
 
- Public Member Functions inherited from iu::Image
 Image ()
 
virtual ~Image ()
 
 Image (unsigned int width, unsigned int height)
 
 Image (const iu::Size< 2 > &size)
 
iu::Size< 2 > size () const
 
unsigned int width () const
 
unsigned int height () const
 
bool sameType (const Image &from)
 
size_t numel () const
 

Protected Attributes

PixelType * data_
 
size_t pitch_
 
bool ext_data_pointer_
 
- Protected Attributes inherited from iu::Image
iu::Size< 2 > size_
 

Detailed Description

template<typename PixelType, class Allocator>
class iu::ImageCpu< PixelType, Allocator >

Host 2D image class (pitched memory).

Member Typedef Documentation

template<typename PixelType, class Allocator>
typedef PixelType iu::ImageCpu< PixelType, Allocator >::pixel_type

Define the current pixel type.

Constructor & Destructor Documentation

template<typename PixelType, class Allocator>
iu::ImageCpu< PixelType, Allocator >::ImageCpu ( )
inline

Constructor.

template<typename PixelType, class Allocator>
virtual iu::ImageCpu< PixelType, Allocator >::~ImageCpu ( )
inlinevirtual

Destructor.

template<typename PixelType, class Allocator>
iu::ImageCpu< PixelType, Allocator >::ImageCpu ( unsigned int  _width,
unsigned int  _height 
)
inline

Special constructor.

Parameters
_widthWidth of the Image
_heightHeight of the Image
template<typename PixelType, class Allocator>
iu::ImageCpu< PixelType, Allocator >::ImageCpu ( const iu::Size< 2 > &  size)
inline

Special constructor.

Parameters
sizeSize of the Image
template<typename PixelType, class Allocator>
iu::ImageCpu< PixelType, Allocator >::ImageCpu ( PixelType *  _data,
unsigned int  _width,
unsigned int  _height,
size_t  _pitch,
bool  ext_data_pointer = false 
)
inline

Special constructor.

Parameters
_dataHost data pointer
_widthWidth of the Image
_heightHeight of the Image
_pitchDistance in bytes between starts of consecutive rows.
ext_data_pointerUse external data pointer as internal data pointer
template<typename PixelType, class Allocator>
iu::ImageCpu< PixelType, Allocator >::ImageCpu ( const ndarray_ref< PixelType, 2 > &  x)

construct from ndarray_ref – include ndarray/ndarray_iu.h

template<typename PixelType, class Allocator>
iu::ImageCpu< PixelType, Allocator >::ImageCpu ( boost::python::api::object &  py_arr)

ImageCpu constructor from numpy array. It wraps the numpy data pointer i.e. does not perform a deep copy. This means that changes to the ImageCpu are transparent to python. Attention: It performs just a basic check if the datatyps are compatible: If you have a numpy array with uint8 and you try to construct a ImageCpu_32f_C1 from it, it will throw an exception. Constructing a ImageCpu_32u_C1 from a numpy float32 array will not give an error (both are 32-bit datatypes)!

include iuypthon.h!

Parameters
py_arra boost::python::object representing a numpy array

Member Function Documentation

template<typename PixelType, class Allocator>
thrust::pointer<PixelType, thrust::host_system_tag> iu::ImageCpu< PixelType, Allocator >::begin ( void  )
inline

Returns a thrust pointer that can be used in custom operators

Returns
Thrust pointer of the begin of the host memory
template<typename PixelType, class Allocator>
virtual unsigned int iu::ImageCpu< PixelType, Allocator >::bitDepth ( ) const
inlinevirtual

Returns the bit depth of the data pointer.

Reimplemented from iu::Image.

template<typename PixelType, class Allocator>
virtual size_t iu::ImageCpu< PixelType, Allocator >::bytes ( ) const
inlinevirtual

Returns the total amount of bytes saved in the data buffer.

Reimplemented from iu::Image.

template<typename PixelType, class Allocator>
PixelType* iu::ImageCpu< PixelType, Allocator >::data ( int  ox = 0,
int  oy = 0 
)
inline

Returns a pointer to the pixel data. The pointer can be offset to position (ox/oy).

Parameters
oxHorizontal offset of the pointer array.
oyVertical offset of the pointer array.
Returns
Pointer to the pixel array.
template<typename PixelType, class Allocator>
const PixelType* iu::ImageCpu< PixelType, Allocator >::data ( int  ox = 0,
int  oy = 0 
) const
inline

Returns a const pointer to the pixel data. The pointer can be offset to position (ox/oy).

Parameters
oxHorizontal offset of the pointer array.
oyVertical offset of the pointer array.
Returns
Const pointer to the pixel array.
template<typename PixelType, class Allocator>
thrust::pointer<PixelType, thrust::host_system_tag> iu::ImageCpu< PixelType, Allocator >::end ( void  )
inline

Returns a thrust pointer that can be used in custom operators

Returns
Thrust pointer of the end of the host memory
template<typename PixelType, class Allocator>
PixelType iu::ImageCpu< PixelType, Allocator >::getPixel ( unsigned int  x,
unsigned int  y 
)
inline

Get Pixel value at position x,y.

template<typename PixelType, class Allocator>
virtual bool iu::ImageCpu< PixelType, Allocator >::onDevice ( ) const
inlinevirtual

Returns flag if the image data resides on the device/GPU (TRUE) or host/GPU (FALSE)

Reimplemented from iu::Image.

template<typename PixelType, class Allocator>
PixelType* iu::ImageCpu< PixelType, Allocator >::operator[] ( unsigned int  row)
inline

Get Pointer to beginning of row (y index). This enables the usage of [y][x] operator.

Parameters
rowy index / beginning of row
template<typename PixelType, class Allocator>
virtual size_t iu::ImageCpu< PixelType, Allocator >::pitch ( ) const
inlinevirtual

Returns the distance in bytes between starts of consecutive rows.

Reimplemented from iu::Image.

template<typename PixelType, class Allocator>
ndarray_ref<PixelType,2> iu::ImageCpu< PixelType, Allocator >::ref ( ) const

convert to ndarray_ref – include ndarray/ndarray_iu.h

template<typename PixelType, class Allocator>
virtual size_t iu::ImageCpu< PixelType, Allocator >::stride ( ) const
inlinevirtual

Returns the distance in pixels between starts of consecutive rows.

Reimplemented from iu::Image.

Field Documentation

template<typename PixelType, class Allocator>
PixelType* iu::ImageCpu< PixelType, Allocator >::data_
protected

Pointer to host buffer.

template<typename PixelType, class Allocator>
bool iu::ImageCpu< PixelType, Allocator >::ext_data_pointer_
protected

Flag if data pointer is handled outside the image class.

template<typename PixelType, class Allocator>
size_t iu::ImageCpu< PixelType, Allocator >::pitch_
protected

Distance in bytes between starts of consecutive rows.


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