CudaImage.H File Reference

#include "Util/Assert.H"
#include "Util/Promotions.H"
#include "Image/ArrayData.H"
#include "Image/Point2D.H"
#include "Image/Rectangle.H"
#include "Image/Image.H"
#include "Image/Pixels.H"
#include "CUDA/wrap_c_cuda.h"
#include <algorithm>
Include dependency graph for CudaImage.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CudaImage< T >
 CudaImage template class. More...

Functions

template<class T >
CudaImage< T > reshape (const CudaImage< T > &orig, const Dims &newdims)
 Return a new Image with the same data, but interpreted as a different shape.

Detailed Description

An image template class meant for interacting with CUDA devices

Definition in file CudaImage.H.


Function Documentation

template<class T >
CudaImage<T> reshape ( const CudaImage< T > &  orig,
const Dims newdims 
) [inline]

Return a new Image with the same data, but interpreted as a different shape.

NOTE that this is very different from resize()! With reshape(), we are not changing the number of elements in the Image; rather we are just changing the way that the internal 1-D memory array is mapped to a logical 2-D Image. For example, you could reshape a 10x5 Image to a 50x1 Image, or a 25x2 Image, or vice versa. You need to be aware the fact that Image uses a row-major storage format internally (i.e., as you step through the memory, you first traverse all the pixels in row 1, then all the pixels in row 2, etc.). So if you reshape a WxH Image to a WHx1 Image, your new 1-D Image will appear to have the rows of the original Image arranged end-to-end.

Programmer note: In principle, we could support a reshape() operation that wouldn't require copying any data; in order to do that we'd need to split the Dims management out of ArrayData and ArrayHandle, so that a single ArrayData object could be used in multiple Image objects, each with potentially different Dims (but all with the same total number of pixels). However, for now we just use a simpler implementation which copies the data into the new Image.

Definition at line 410 of file CudaImage.H.

References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), and Dims::sz().

Referenced by TaskRelevanceMapTigs2::inputFrame(), and TaskRelevanceMapGistClassify::integrate().

Generated on Sun May 8 08:11:16 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3