CudaImage template class. More...
#include <CUDA/CudaImage.H>
Public Member Functions | |
void | clear (const char &val=0) |
clear contents (or set to given value) | |
Constructors, destructors, assignment | |
CudaImage (const T *inarray, int width, int height, const MemoryPolicy mp, const int dev, const MemoryPolicy srcmp, const int srcdev) | |
Construct from C array using memory policy. | |
CudaImage (const T *inarray, const Dims &dims, const MemoryPolicy mp, const int dev, const MemoryPolicy srcmp, const int srcdev) | |
Construct from C array using memory policy. | |
CudaImage (int width, int height, InitPolicy init, const MemoryPolicy mp, const int dev) | |
Allocates memory for given size, optionally zero-clear that memory, and set the memory policy. | |
CudaImage (const Dims &dims, const MemoryPolicy mp, const int dev) | |
Constructor that only allocates memory for given size. | |
CudaImage (const Dims &dims, InitPolicy init, const MemoryPolicy mp, const int dev) | |
Constructor that only allocates memory for given size and init type. | |
CudaImage () | |
Construct an empty (0-by-0) image (useful for arrays of CudaImages). | |
CudaImage (const CudaImage< T > &A) | |
Copy constructor. | |
CudaImage (const CudaImage< T > &A, const MemoryPolicy mp, const int dev) | |
Copy constructor to particular memory. | |
CudaImage (const Image< T > &A, const MemoryPolicy mp, const int dev) | |
Import copy constructor. | |
CudaImage< T > & | operator= (const CudaImage< T > &A) |
Assigment operator. | |
~CudaImage () | |
Destructor. | |
void | freeMem () |
Free memory and switch to uninitialized state. | |
Math operators | |
CudaImage< float > & | operator+= (const float val) |
Math operators. | |
CudaImage< float > & | operator-= (const float val) |
Subtraction inplace by a host provided scalar. | |
CudaImage< float > & | operator*= (const float val) |
Multiplication inplace by a host provided scalar. | |
CudaImage< float > & | operator/= (const float val) |
Division inplace by a host provided scalar. | |
CudaImage< float > & | operator+= (const CudaImage< float > &im) |
Addition inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
CudaImage< float > & | operator-= (const CudaImage< float > &im) |
Subtraction inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
CudaImage< float > & | operator*= (const CudaImage< float > &im) |
Multiplication inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
CudaImage< float > & | operator/= (const CudaImage< float > &im) |
Division inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
CudaImage< float > | operator+ (const float val) const |
Addition by a host provided scalar. | |
CudaImage< float > | operator- (const float val) const |
Subtraction by a host provided scalar. | |
CudaImage< float > | operator* (const float val) const |
Multiplcation by a host provided scalar. | |
CudaImage< float > | operator/ (const float val) const |
Division by a host provided scalar. | |
CudaImage< float > | operator+ (const CudaImage< float > &im) const |
Addition by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
CudaImage< float > | operator- (const CudaImage< float > &im) const |
Subtraction by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
CudaImage< float > | operator* (const CudaImage< float > &im) const |
Multiplication by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
CudaImage< float > | operator/ (const CudaImage< float > &im) const |
Division by a device image or scalar (a 1x1 CudaImage is treated as a scalar). | |
Memory management functions | |
void | swap (CudaImage< T > &other) |
Swap the contents of two images. | |
CudaImage< T > | deepcopy () const |
Return a new image object with a deep copy of the underlying data. | |
CudaImage< T > | deepcopy (const MemoryPolicy mp, const int dev) const |
Return a new image w/ deep copy of underlying data using memory policy. | |
Image< T > | exportToImage () const |
void | resize (const Dims &dims, const bool clear=false) |
Free mem and realloc new array (array contents are lost). | |
void | resize (const int width, const int height, const bool clear=false) |
Free mem and realloc new array (array contents are lost). | |
Access functions | |
bool | initialized () const |
Check whether image is non-empty (i.e., non-zero height and width). | |
int | getSize () const |
Get image size (width * height). | |
uint | size () const |
Get image size (width * height). | |
int | getWidth () const |
Get image width. | |
int | getHeight () const |
Get image height. | |
const Dims & | getDims () const |
Get image width+height in Dims struct. | |
Rectangle | getBounds () const |
Get image bounds as a rectangle with upper-left point at (0,0) and dims matching the image dims. | |
template<class C > | |
bool | isSameSize (const C &other) const |
Check if *this is the same size as the other thing. | |
bool | is1D () const |
Check if the image is 1D, i.e., width == 1 or height == 1. | |
bool | isVector () const |
Check if the image is a vector, i.e., width == 1. | |
bool | isTransposedVector () const |
Check if the image is a transposed vector, i.e., height == 1. | |
bool | isSquare () const |
Check if the image is square, i.e., width == height. | |
const T * | getCudaArrayPtr () const |
Returns read-only (const) pointer to internal image array. | |
T * | getCudaArrayPtr () |
Returns read/write (non-const) pointer to internal image array. | |
bool | coordsOk (const Point2D< int > &P) const |
Test whether point falls inside array boundaries. | |
bool | coordsOk (const int i, const int j) const |
Test whether point falls inside array boundaries. | |
bool | coordsOk (const Point2D< float > &p) const |
Test whether point falls inside array boundaries. | |
bool | coordsOk (const float i, const float j) const |
Test whether point falls inside array boundaries. | |
bool | rectangleOk (const Rectangle &rect) const |
Test whether rectangle fits in image. | |
MemoryPolicy | getMemoryPolicy () const |
Return memory policy of underlying array data. | |
int | getMemoryDevice () const |
Return memory policy of underlying array data. | |
Functions for testing/debugging only | |
bool | hasSameData (const CudaImage< T > &b) const |
For testing/debugging only. | |
long | refCount () const throw () |
For testing/debugging only. | |
bool | isShared () const throw () |
For testing/debugging only. | |
Public Attributes | |
int | width |
int | height |
int | pitch |
float * | h_data |
float * | d_data |
void * | t_data |
CudaImage template class.
This is a image template class for CUDA devices that can handle grayscale as well as color or multispectral images. CudaImage methods should be instantiable for any type T that has the basic arithmetic operators. However, our CUDA processing is inherently float based, so conversions may occur. Note that some CudaImage functions will only work with float types, and other will only work for composite types such as PixRGB.
Definition at line 63 of file CudaImage.H.
CudaImage< T >::CudaImage | ( | const T * | inarray, | |
int | width, | |||
int | height, | |||
const MemoryPolicy | mp, | |||
const int | dev, | |||
const MemoryPolicy | srcmp, | |||
const int | srcdev | |||
) | [inline] |
Construct from C array using memory policy.
Build from C array; an internal copy of the C array will be allocated, so the C array can (and should) be freed without affecting the Image.
Definition at line 430 of file CudaImage.H.
CudaImage< T >::CudaImage | ( | const T * | inarray, | |
const Dims & | dims, | |||
const MemoryPolicy | mp, | |||
const int | dev, | |||
const MemoryPolicy | srcmp, | |||
const int | srcdev | |||
) | [inline] |
Construct from C array using memory policy.
Build from C array; an internal copy of the C array will be allocated, so the C array can (and should) be freed without affecting the CudaImage.
Definition at line 436 of file CudaImage.H.
CudaImage< T >::CudaImage | ( | int | width, | |
int | height, | |||
InitPolicy | init, | |||
const MemoryPolicy | mp, | |||
const int | dev | |||
) | [inline] |
Allocates memory for given size, optionally zero-clear that memory, and set the memory policy.
Definition at line 442 of file CudaImage.H.
CudaImage< T >::CudaImage | ( | const Dims & | dims, | |
const MemoryPolicy | mp, | |||
const int | dev | |||
) | [inline, explicit] |
Constructor that only allocates memory for given size.
Definition at line 448 of file CudaImage.H.
CudaImage< T >::CudaImage | ( | const Dims & | dims, | |
InitPolicy | init, | |||
const MemoryPolicy | mp, | |||
const int | dev | |||
) | [inline, explicit] |
Constructor that only allocates memory for given size and init type.
Definition at line 454 of file CudaImage.H.
Construct an empty (0-by-0) image (useful for arrays of CudaImages).
Definition at line 460 of file CudaImage.H.
Copy constructor.
e.g.:
CudaImage<byte> im(other); // or CudaImage<byte> im = other; // with other also of type CudaImage<byte>
Definition at line 466 of file CudaImage.H.
CudaImage< T >::CudaImage | ( | const CudaImage< T > & | A, | |
const MemoryPolicy | mp, | |||
const int | dev | |||
) | [inline] |
Copy constructor to particular memory.
e.g.:
CudaImage<byte> im(other); // or CudaImage<byte> im = other; // with other also of type CudaImage<byte>
Definition at line 472 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), and CudaImage< T >::size().
CudaImage< T >::CudaImage | ( | const Image< T > & | A, | |
const MemoryPolicy | mp, | |||
const int | dev | |||
) | [inline] |
Import copy constructor.
e.g.:
CudaImage<byte> im(other); // or CudaImage<byte> im = other; // with other of type CudaImage<float>
Definition at line 485 of file CudaImage.H.
References CUDA_HOST_DEVICE_NUM, Image< T >::getArrayPtr(), CudaImage< T >::getCudaArrayPtr(), HOST_MEMORY, and CudaImage< T >::size().
Destructor.
Definition at line 761 of file CudaImage.H.
void CudaImage< T >::clear | ( | const char & | val = 0 |
) | [inline] |
clear contents (or set to given value)
Definition at line 971 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), NO_INIT, and CudaImage< T >::size().
Referenced by CudaSaliency::calcInhibition(), CudaImage< T >::resize(), and CudaHmaxFL::setC1Patches().
bool CudaImage< T >::coordsOk | ( | const float | i, | |
const float | j | |||
) | const [inline] |
Test whether point falls inside array boundaries.
This test is intended to be used before you attempt a getValInterp()
Definition at line 938 of file CudaImage.H.
References CudaImage< T >::getHeight(), and CudaImage< T >::getWidth().
Test whether point falls inside array boundaries.
This test is intended to be used before you attempt a getValInterp()
Definition at line 931 of file CudaImage.H.
References CudaImage< T >::coordsOk(), and Point2D< T >::i.
bool CudaImage< T >::coordsOk | ( | const int | i, | |
const int | j | |||
) | const [inline] |
Test whether point falls inside array boundaries.
Definition at line 924 of file CudaImage.H.
References CudaImage< T >::getHeight(), and CudaImage< T >::getWidth().
Test whether point falls inside array boundaries.
Definition at line 917 of file CudaImage.H.
References CudaImage< T >::getHeight(), CudaImage< T >::getWidth(), and Point2D< T >::i.
Referenced by CudaImage< T >::coordsOk(), and cudaCrop().
CudaImage< T > CudaImage< T >::deepcopy | ( | const MemoryPolicy | mp, | |
const int | dev | |||
) | const [inline] |
Return a new image w/ deep copy of underlying data using memory policy.
This function is needed to allow new image generation to any memory area in the system, which is going to have to be a deep copy
Definition at line 785 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), and CudaImage< T >::getMemoryPolicy().
Return a new image object with a deep copy of the underlying data.
This function is necessary for safe use of attach()/detach(). That is, unfortunately attach()/detach() are not safe for use with shared image objects -- consider the following code:
double d[4] = { 0.0, 1.0, 2.0, 3.0}; // create an CudaImage that is attach()'ed to the double array CudaImage<double> a; a.attach(&d[0], 2, 2); const CudaImage<double> b = a; // now 'b' thinks it has a safe lock on some const values: d[0] = -1.0; // OOPS! By changing values in the 'd' array directly, we'll now // have changed things to that b[0] == -1.0, even though 'b' was // declared as 'const'
The solution to this problem is to prohibit the copy done in 'b=a' above (this triggers an LFATAL() in ArrayData::acquire()). That assures us that any ArrayData that has a StoragePolicy of WRITE_THRU will be un-shareable.
So, back to the point -- the correct way to write the code above would be to use deepcopy():
double d[4] = { 0.0, 1.0, 2.0, 3.0}; CudaImage<double> a; a.attach(&d[0], 2, 2); const CudaImage<double> b = a.deepcopy(); d[0] = -1.0; // Now, 'b' is insulated from any changes to 'd' since we've // done a deep copy, so even now we'll still have b[0]==0.0
void CudaImage< T >::freeMem | ( | ) | [inline] |
Free memory and switch to uninitialized state.
Note that it is NOT necessary to call this function to ensure proper cleanup, that will be done in the destructor by default. Rather, freeMem() is offered just as a performance optimization, to allow you to release a potentially large chunk of memory when you are finished using it.
Definition at line 766 of file CudaImage.H.
References CudaImage< T >::swap().
Get image bounds as a rectangle with upper-left point at (0,0) and dims matching the image dims.
Definition at line 873 of file CudaImage.H.
T * CudaImage< T >::getCudaArrayPtr | ( | ) | [inline] |
Returns read/write (non-const) pointer to internal image array.
Definition at line 910 of file CudaImage.H.
const T * CudaImage< T >::getCudaArrayPtr | ( | ) | const [inline] |
Returns read-only (const) pointer to internal image array.
Definition at line 903 of file CudaImage.H.
Referenced by CudaSaliency::calcInertia(), CudaSaliency::calcInhibition(), CudaImage< T >::clear(), cudaCrop(), CudaImage< T >::CudaImage(), cudaInplaceOverlay(), cudaInplacePaste(), cudaShiftImage(), CudaImage< T >::deepcopy(), CudaImage< T >::operator*(), CudaImage< T >::operator*=(), CudaImage< T >::operator+(), CudaImage< T >::operator+=(), CudaImage< T >::operator-(), CudaImage< T >::operator-=(), CudaImage< T >::operator/(), CudaImage< T >::operator/=(), and reshape().
Get image width+height in Dims struct.
Definition at line 868 of file CudaImage.H.
Referenced by CudaSaliency::calcFlicker(), CudaSaliency::calcInertia(), CudaSaliency::calcInhibition(), CudaImage< T >::clear(), cudaCenterSurroundDiff(), cudaCrop(), cudaShiftImage(), CudaImage< T >::deepcopy(), CudaImage< T >::getSize(), CudaImage< T >::operator*(), CudaImage< T >::operator+(), CudaImage< T >::operator-(), CudaImage< T >::operator/(), reshape(), CudaImage< T >::resize(), CudaSaliency::runSaliency(), and CudaImage< T >::size().
int CudaImage< T >::getHeight | ( | ) | const [inline] |
Get image height.
Definition at line 863 of file CudaImage.H.
Referenced by CudaSaliency::calcInertia(), CudaSaliency::calcInhibition(), CudaImage< T >::coordsOk(), cudaCrop(), cudaInplaceOverlay(), cudaInplacePaste(), CudaHmaxFLSal::extractRandC1Patches(), CudaHmaxFL::extractRandC1Patches(), CudaFramework::getCanvasH(), CudaImage< T >::initialized(), CudaImage< T >::is1D(), CudaImage< T >::isSameSize(), CudaImage< T >::isSquare(), CudaImage< T >::isTransposedVector(), CudaImage< T >::rectangleOk(), CudaSaliency::runSaliency(), and CudaHmaxFL::windowedPatchDistance().
int CudaImage< T >::getMemoryDevice | ( | ) | const [inline] |
Return memory policy of underlying array data.
Definition at line 963 of file CudaImage.H.
Referenced by CudaSaliency::calcInertia(), CudaSaliency::calcInhibition(), CudaImage< T >::clear(), cudaCrop(), CudaImage< T >::CudaImage(), cudaInplaceOverlay(), cudaInplacePaste(), cudaShiftImage(), CudaImage< T >::deepcopy(), CudaImage< T >::operator*(), CudaImage< T >::operator*=(), CudaImage< T >::operator+(), CudaImage< T >::operator+=(), CudaImage< T >::operator-(), CudaImage< T >::operator-=(), CudaImage< T >::operator/(), CudaImage< T >::operator/=(), reshape(), and CudaImage< T >::resize().
MemoryPolicy CudaImage< T >::getMemoryPolicy | ( | ) | const [inline] |
Return memory policy of underlying array data.
Definition at line 956 of file CudaImage.H.
Referenced by CudaSaliency::calcInertia(), CudaSaliency::calcInhibition(), CudaImage< T >::clear(), cudaCrop(), CudaImage< T >::CudaImage(), cudaShiftImage(), CudaImage< T >::deepcopy(), CudaImage< T >::operator*(), CudaImage< T >::operator+(), CudaImage< T >::operator-(), CudaImage< T >::operator/(), reshape(), and CudaImage< T >::resize().
int CudaImage< T >::getSize | ( | ) | const [inline] |
Get image size (width * height).
Definition at line 848 of file CudaImage.H.
References CudaImage< T >::getDims(), and Dims::sz().
Referenced by CudaImage< T >::operator*(), CudaImage< T >::operator*=(), CudaImage< T >::operator+(), CudaImage< T >::operator+=(), CudaImage< T >::operator-(), CudaImage< T >::operator-=(), CudaImage< T >::operator/(), and CudaImage< T >::operator/=().
int CudaImage< T >::getWidth | ( | ) | const [inline] |
Get image width.
Definition at line 858 of file CudaImage.H.
Referenced by CudaSaliency::calcInertia(), CudaSaliency::calcInhibition(), CudaImage< T >::coordsOk(), cudaCrop(), cudaInplaceOverlay(), cudaInplacePaste(), CudaHmaxFLSal::extractRandC1Patches(), CudaHmaxFL::extractRandC1Patches(), CudaFramework::getCanvasW(), CudaImage< T >::initialized(), CudaImage< T >::is1D(), CudaImage< T >::isSameSize(), CudaImage< T >::isSquare(), CudaImage< T >::isVector(), CudaImage< T >::rectangleOk(), CudaSaliency::runSaliency(), and CudaHmaxFL::windowedPatchDistance().
For testing/debugging only.
Definition at line 989 of file CudaImage.H.
bool CudaImage< T >::initialized | ( | ) | const [inline] |
Check whether image is non-empty (i.e., non-zero height and width).
Definition at line 843 of file CudaImage.H.
References CudaImage< T >::getHeight(), and CudaImage< T >::getWidth().
Referenced by CudaSaliency::calcFlicker(), CudaSaliency::calcIntensity(), CudaSaliency::calcMotion(), CudaSaliency::calcOrientation(), cudaBuildPyrGaussian(), cudaBuildPyrLaplacian(), cudaBuildPyrLocalAvg(), cudaBuildPyrLocalMax(), cudaBuildPyrOriented(), CudaSaliency::cudaPostChannel(), cudaShiftImage(), CudaImage< T >::operator*(), CudaImage< T >::operator*=(), CudaImage< T >::operator+(), CudaImage< T >::operator+=(), CudaImage< T >::operator-(), CudaImage< T >::operator-=(), CudaImage< T >::operator/(), CudaImage< T >::operator/=(), and CudaSaliency::runSaliency().
bool CudaImage< T >::is1D | ( | ) | const [inline] |
Check if the image is 1D, i.e., width == 1 or height == 1.
Definition at line 883 of file CudaImage.H.
References CudaImage< T >::getHeight(), and CudaImage< T >::getWidth().
bool CudaImage< T >::isSameSize | ( | const C & | other | ) | const [inline] |
Check if *this is the same size as the other thing.
The other thing can be any type that exposes getHeight() and getWidth()
Definition at line 878 of file CudaImage.H.
References CudaImage< T >::getHeight(), and CudaImage< T >::getWidth().
Referenced by CudaImage< T >::operator*(), CudaImage< T >::operator*=(), CudaImage< T >::operator+(), CudaImage< T >::operator+=(), CudaImage< T >::operator-(), CudaImage< T >::operator-=(), CudaImage< T >::operator/(), and CudaImage< T >::operator/=().
bool CudaImage< T >::isShared | ( | ) | const throw () [inline] |
For testing/debugging only.
Check if the ArrayHandle is shared.
Definition at line 998 of file CudaImage.H.
bool CudaImage< T >::isSquare | ( | ) | const [inline] |
Check if the image is square, i.e., width == height.
Definition at line 898 of file CudaImage.H.
References CudaImage< T >::getHeight(), and CudaImage< T >::getWidth().
bool CudaImage< T >::isTransposedVector | ( | ) | const [inline] |
Check if the image is a transposed vector, i.e., height == 1.
Definition at line 893 of file CudaImage.H.
References CudaImage< T >::getHeight().
bool CudaImage< T >::isVector | ( | ) | const [inline] |
Check if the image is a vector, i.e., width == 1.
Definition at line 888 of file CudaImage.H.
References CudaImage< T >::getWidth().
CudaImage< float > CudaImage< T >::operator* | ( | const CudaImage< float > & | im | ) | const [inline] |
Multiplication by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 720 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
Multiplcation by a host provided scalar.
Definition at line 652 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
CudaImage< float > & CudaImage< T >::operator*= | ( | const CudaImage< float > & | im | ) | [inline] |
Multiplication inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 587 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), CudaImage< T >::size(), and Dims::sz().
Multiplication inplace by a host provided scalar.
Definition at line 524 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::size(), and Dims::sz().
CudaImage< float > CudaImage< T >::operator+ | ( | const CudaImage< float > & | im | ) | const [inline] |
Addition by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 680 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
Addition by a host provided scalar.
Definition at line 628 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
CudaImage< float > & CudaImage< T >::operator+= | ( | const CudaImage< float > & | im | ) | [inline] |
Addition inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 547 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), CudaImage< T >::size(), and Dims::sz().
Math operators.
Addition inplace by a host provided scalar
Definition at line 504 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::size(), and Dims::sz().
CudaImage< float > CudaImage< T >::operator- | ( | const CudaImage< float > & | im | ) | const [inline] |
Subtraction by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 700 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
Subtraction by a host provided scalar.
Definition at line 640 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
CudaImage< float > & CudaImage< T >::operator-= | ( | const CudaImage< float > & | im | ) | [inline] |
Subtraction inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 567 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), CudaImage< T >::size(), and Dims::sz().
Subtraction inplace by a host provided scalar.
Definition at line 514 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::size(), and Dims::sz().
CudaImage< float > CudaImage< T >::operator/ | ( | const CudaImage< float > & | im | ) | const [inline] |
Division by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 740 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
Division by a host provided scalar.
Definition at line 664 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), NO_INIT, CudaImage< T >::size(), and Dims::sz().
CudaImage< float > & CudaImage< T >::operator/= | ( | const CudaImage< float > & | im | ) | [inline] |
Division inplace by a device image or scalar (a 1x1 CudaImage is treated as a scalar).
Definition at line 607 of file CudaImage.H.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getSize(), CudaImage< T >::initialized(), CudaImage< T >::isSameSize(), CudaImage< T >::size(), and Dims::sz().
Division inplace by a host provided scalar.
Definition at line 534 of file CudaImage.H.
References CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::size(), and Dims::sz().
Assigment operator.
e.g.:
CudaImage<byte> im1, im2; im2 = im1;
Definition at line 496 of file CudaImage.H.
References CudaImage< T >::swap().
Test whether rectangle fits in image.
Definition at line 946 of file CudaImage.H.
References Rectangle::bottomI(), CudaImage< T >::getHeight(), CudaImage< T >::getWidth(), Rectangle::left(), Rectangle::rightI(), and Rectangle::top().
long CudaImage< T >::refCount | ( | ) | const throw () [inline] |
For testing/debugging only.
Returns the current reference count.
Definition at line 994 of file CudaImage.H.
void CudaImage< T >::resize | ( | const int | width, | |
const int | height, | |||
const bool | clear = false | |||
) | [inline] |
Free mem and realloc new array (array contents are lost).
Use rescale() instead if you want to preserve image contents.
Definition at line 832 of file CudaImage.H.
References CudaImage< T >::resize().
void CudaImage< T >::resize | ( | const Dims & | dims, | |
const bool | clear = false | |||
) | [inline] |
Free mem and realloc new array (array contents are lost).
Use rescale() instead if you want to preserve image contents.
Definition at line 808 of file CudaImage.H.
References CudaImage< T >::clear(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), NO_INIT, and ZEROS.
Referenced by CudaHmaxFLSal::extractRandC1Patches(), CudaHmaxFL::extractRandC1Patches(), and CudaImage< T >::resize().
Get image size (width * height).
Definition at line 853 of file CudaImage.H.
References CudaImage< T >::getDims(), and Dims::sz().
Referenced by CudaImage< T >::clear(), CudaImage< T >::CudaImage(), CudaImage< T >::operator*(), CudaImage< T >::operator*=(), CudaImage< T >::operator+(), CudaImage< T >::operator+=(), CudaImage< T >::operator-(), CudaImage< T >::operator-=(), CudaImage< T >::operator/(), and CudaImage< T >::operator/=().
Swap the contents of two images.
Definition at line 778 of file CudaImage.H.
Referenced by CudaImage< T >::freeMem(), and CudaImage< T >::operator=().