Image.H File Reference

#include "Util/Assert.H"
#include "Util/Promotions.H"
#include "Image/ArrayData.H"
#include "Image/Point2D.H"
#include "Image/Rectangle.H"
#include <algorithm>
#include <iterator>
Include dependency graph for Image.H:

Go to the source code of this file.

Classes

class  Image< T >
 Generic image template class. More...
struct  std::iterator_traits< Image< T > >

Namespaces

namespace  std
 

The Standard Template Library (STL).


Functions

template<class T >
Image< T > reshape (const Image< 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 with many image processing functions

Definition in file Image.H.


Function Documentation

template<class T >
Image<T> reshape ( const Image< 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 566 of file Image.H.

References ASSERT.

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