Imagine++
Public Types | Public Member Functions | Friends | List of all members
Imagine::Image< T, dim > Class Template Reference

Image. More...

#include "Imagine/Images.h"

Inheritance diagram for Imagine::Image< T, dim >:
Imagine::MultiArray< T, dim > Imagine::Array< T >

Public Types

typedef Base::const_iterator const_iterator
 Const iterator type.
 
typedef Base::iterator iterator
 Iterator type.
 
typedef PixelTraits< T >::scalar_type scalar_type
 Scalar type. More...
 
- Public Types inherited from Imagine::MultiArray< T, dim >
typedef const T * const_iterator
 Const iterator type.
 
typedef T * iterator
 Iterator type.
 
- Public Types inherited from Imagine::Array< T >
typedef const T * const_iterator
 Const iterator type.
 
typedef T * iterator
 Iterator type.
 

Public Member Functions

 Image ()
 Empty constructor. More...
 
 Image (const Coords< dim > &sz)
 Constructor (known size). More...
 
 Image (int w, int h)
 Constructor (known size, 2D). More...
 
 Image (int w, int h, int d)
 Constructor (known size, 3D). More...
 
 Image (T *ptr, const Coords< dim > &sz, bool handleDelete=false)
 Constructor (pre-allocated). More...
 
 Image (T *ptr, int w, int h, bool handleDelete=false)
 Constructor (pre-allocated 2D). More...
 
 Image (T *ptr, int w, int h, int d, bool handleDelete=false)
 Constructor (pre-allocated 3D). More...
 
 Image (const Base &I)
 Copy constructor. More...
 
template<typename T2 >
 Image (const MultiArray< T2, dim > &I)
 Constructor (different type). More...
 
virtual ~Image ()
 Destructor. More...
 
Image clone () const
 Cloning. More...
 
dirichlet (const Coords< dim > &c, T out=T(0)) const
 Dirichlet access. More...
 
dirichlet (int x, int y, T out=T(0)) const
 Dirichlet (2D alias).
 
dirichlet (int x, int y, int z, T out=T(0)) const
 Dirichlet (3D alias).
 
Imagefill (T x)
 Filling. More...
 
Image getSubImage (const Coords< dim > &offset, const Coords< dim > &sz) const
 Sub image. More...
 
Image getSubImage (int x, int y, int w, int h) const
 Sub image (2D). More...
 
Image getSubImage (int x, int y, int z, int w, int h, int d) const
 Sub image (3D). More...
 
template<typename V >
PixelTraits< T >::template CastPixel< V >::value_type interpolate (const FVector< V, dim > &c) const
 Interpolation. More...
 
template<typename V >
PixelTraits< T >::template CastPixel< V >::value_type interpolate (V x, V y) const
 Interpolation with automated return type, 2D alias.
 
template<typename V >
PixelTraits< T >::template CastPixel< V >::value_type interpolate (V x, V y, V z) const
 Interpolation with automated return type, 3D alias.
 
invMirror (const Coords< dim > &c) const
 Inversed mirror access. More...
 
invMirror (int x, int y) const
 Inversed mirror access (2D alias).
 
invMirror (int x, int y, int z) const
 Inversed mirror access (3D alias).
 
mirror (const Coords< dim > &c) const
 Mirror access. More...
 
mirror (int x, int y) const
 Mirror access (2D alias).
 
mirror (int x, int y, int z) const
 Mirror access (3D alias).
 
neumann (const Coords< dim > &c) const
 Neumann access. More...
 
neumann (int x, int y) const
 Neumann (2D alias).
 
neumann (int x, int y, int z) const
 Neumann (3D alias).
 
Image operator* (scalar_type s) const
 Scalar multiplication. More...
 
Image operator* (const Image< scalar_type, dim > &B) const
 Pointwise scalar multiplication. More...
 
Imageoperator*= (scalar_type s)
 In place scalar multiplication. More...
 
Imageoperator*= (const Image< scalar_type, dim > &B)
 In place pointwise scalar multiplication. More...
 
Image operator+ (const Image &B) const
 Addition. More...
 
Image operator+ (T v) const
 Constant addition. More...
 
Imageoperator+= (const Image &B)
 In place Addition. More...
 
Imageoperator+= (T v)
 In place constant addition. More...
 
Image operator- () const
 Opposite. More...
 
Image operator- (const Image &B) const
 Substraction. More...
 
Image operator- (T v) const
 Constant substraction. More...
 
Imageoperator-= (const Image &B)
 In place substraction. More...
 
Imageoperator-= (T v)
 In place constant substraction. More...
 
Image operator/ (scalar_type s) const
 Scalar division. More...
 
Image operator/ (const Image< scalar_type, dim > &B) const
 Pointwise scalar division. More...
 
Imageoperator/= (scalar_type s)
 In place scalar division. More...
 
Imageoperator/= (const Image< scalar_type, dim > &B)
 In place pointwise scalar division. More...
 
Imageoperator= (const Base &I)
 Assignment. More...
 
template<typename T2 >
Imageoperator= (const MultiArray< T2, dim > &I)
 Assignment (different type). More...
 
- Public Member Functions inherited from Imagine::MultiArray< T, dim >
 MultiArray ()
 Empty constructor. More...
 
 MultiArray (const Coords< dim > &sz)
 Constructor (known size). More...
 
 MultiArray (int s0, int s1)
 Constructor (2D shorcut). More...
 
 MultiArray (int s0, int s1, int s2)
 Constructor (3D shorcut). More...
 
 MultiArray (T *ptr, const Coords< dim > &sz, bool handleDelete=false)
 Constructor (pre-allocated). More...
 
 MultiArray (T *ptr, int s0, int s1, bool handleDelete=false)
 Constructor (pre-allocated) 2D alias. More...
 
 MultiArray (T *ptr, int s0, int s1, int s2, bool handleDelete=false)
 Constructor (pre-allocated) 3D alias. More...
 
 MultiArray (const MultiArray &A)
 Copy constructor. More...
 
template<typename T2 >
 MultiArray (const MultiArray< T2, dim > &A)
 Constructor (different type). More...
 
virtual ~MultiArray ()
 Destructor. More...
 
MultiArray clone () const
 Cloning. More...
 
CoordsIterator< dim > coordsBegin () const
 Begin coords iterator. More...
 
CoordsIterator< dim > coordsEnd () const
 End coords iterator. More...
 
int depth () const
 Size alias 2. More...
 
MultiArrayfill (T x)
 Filling. More...
 
MultiArray getSubArray (const Coords< dim > &offset, const Coords< dim > &sz) const
 Sub array. More...
 
int height () const
 Size alias 1. More...
 
size_t offset (const Coords< dim > &c) const
 Offset. More...
 
size_t offset (int x, int y) const
 Offset (2D alias). More...
 
size_t offset (int x, int y, int z) const
 Offset (3D alias). More...
 
const T & operator() (const Coords< dim > &c) const
 Read access. More...
 
T & operator() (const Coords< dim > &c)
 Write access. More...
 
const T & operator() (int x, int y) const
 Read access 2D alias. More...
 
T & operator() (int x, int y)
 Write access 2D alias. More...
 
const T & operator() (int x, int y, int z) const
 Read access 3D alias. More...
 
T & operator() (int x, int y, int z)
 Write access 3D alias. More...
 
MultiArrayoperator= (const MultiArray &A)
 Assignment. More...
 
template<typename T2 >
MultiArrayoperator= (const MultiArray< T2, dim > &A)
 Assignment (different type). More...
 
void setSize (const Coords< dim > &sz)
 Change sizes. More...
 
void setSize (int s0, int s1)
 Change size 2D alias. More...
 
void setSize (int s0, int s1, int s2)
 Change size 3D alias. More...
 
int size (int i) const
 ith size. More...
 
Coords< dim > sizes () const
 Sizes. More...
 
FArray< size_t, dim > stride () const
 Stride. More...
 
size_t stride (int i) const
 ith stride. More...
 
size_t totalSize () const
 Total Size. More...
 
int width () const
 Size alias 0. More...
 
- Public Member Functions inherited from Imagine::Array< T >
 Array ()
 Empty constructor. More...
 
 Array (size_t size)
 Constructor (known size). More...
 
 Array (T *ptr, size_t size, bool handleDelete=false)
 Constructor (pre-allocated). More...
 
 Array (const Array &A)
 Copy constructor. More...
 
template<typename T2 >
 Array (const Array< T2 > &A)
 Constructor (different type). More...
 
 Array (const std::list< T > &L)
 Constructor (from list). More...
 
virtual ~Array ()
 Destructor. More...
 
iterator begin ()
 Begin iterator. More...
 
const_iterator begin () const
 Begin const iterator. More...
 
Array clone () const
 Cloning. More...
 
T * data ()
 Data pointer (read/write). More...
 
const T * data () const
 Data pointer (read). More...
 
bool empty () const
 Is empty. More...
 
iterator end ()
 End iterator. More...
 
const_iterator end () const
 End const iterator. More...
 
Arrayfill (const T &x)
 Filling. More...
 
Array getSubArray (size_t offset, size_t size) const
 Sub array. More...
 
bool operator!= (const Array &A) const
 Inequality test. More...
 
Arrayoperator= (const Array &A)
 Assignment. More...
 
template<typename T2 >
Arrayoperator= (const Array< T2 > &A)
 Assignment (different type). More...
 
bool operator== (const Array &A) const
 Equality test. More...
 
const T & operator[] (size_t i) const
 Read access. More...
 
T & operator[] (size_t i)
 Write access. More...
 
void setSize (size_t size)
 Change size. More...
 
size_t size () const
 Size. More...
 

Friends

scalar_type norm (const Image &I)
 Euclidean norm. More...
 
scalar_type norm2 (const Image &I)
 Squared Euclidean norm. More...
 
Image operator* (scalar_type s, const Image &I)
 Scalar multiplication. More...
 
Image operator+ (T v, const Image &I)
 Constant addition. More...
 
Image operator- (T v, const Image &I)
 Constant substraction. More...
 
sum (const Image &I)
 Sum of pixels. More...
 

Detailed Description

template<typename T, int dim = 2>
class Imagine::Image< T, dim >

Image of variable size, dimension and pixel type. Memory is reference counted, i.e.:

Parameters
Tpixel type
dimdimension (default=2)
Examples:
Images/test/test.cpp.

Member Typedef Documentation

◆ scalar_type

template<typename T, int dim = 2>
typedef PixelTraits<T>::scalar_type Imagine::Image< T, dim >::scalar_type

This is useful for images whose pixel type T is itself composed, like an FVector<U>, RGB<U>, or Color, in which case scalar_type is U (byte for Color).

Constructor & Destructor Documentation

◆ Image() [1/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( )
inline

Constructs an unallocated image of pixels of type T

Image<byte> A; // non allocated

◆ Image() [2/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( const Coords< dim > &  sz)
inlineexplicit

Constructs an allocated image of pixels of type T and dimension dim. sz[i] specifies size for dimension i.

Parameters
szimage sizes
Image<byte,3> B(Coords<3>(20,20,20)); // allocated with specified size

◆ Image() [3/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( int  w,
int  h 
)
inline

Constructs an allocated image of pixels of type T and dimension 2.

Parameters
w,himage size
Image<byte> C(20,20); // allocated with specified size (2D alias)

◆ Image() [4/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( int  w,
int  h,
int  d 
)
inline

Constructs an allocated image of pixels of type T and dimension 3.

Parameters
w,h,dimage size
Image<byte,3> D(20,20,20); // allocated with specified size (3D alias)

◆ Image() [5/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( T *  ptr,
const Coords< dim > &  sz,
bool  handleDelete = false 
)
inline

Constructs an image of pixels of type T and dimension dim, stored at an already allocated memory. ptr contains elements (0,0,...), (1,0,...), ... Does not allocate fresh memory. Does not free given memory at object destruction unless handleDelete=true. This memory must indeed stay available during object life.

Parameters
ptraddress of memory
szimage sizes
handleDeletedelete memory at destruction? (default=false)
byte t1[]={1,2,3,4,5,6}; // pre-allocated
Image<byte> E(t1,Coords<2>(2,3));
byte *t2=new byte[6];
Image<byte> F(t2,Coords<2>(2,3),true); // ...

◆ Image() [6/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( T *  ptr,
int  w,
int  h,
bool  handleDelete = false 
)
inline

Constructs an image of pixels of type T and dimension 2, stored at an already allocated memory. Does not allocate fresh memory. Does not free given memory at object destruction unless handleDelete=true. This memory must indeed stay available during object life.

Parameters
ptraddress of memory
w,himage size
handleDeletedelete memory at destruction? (default=false)
Image<byte> G(t1,2,3); // pre-allocated, 2D

◆ Image() [7/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( T *  ptr,
int  w,
int  h,
int  d,
bool  handleDelete = false 
)
inline

Constructs an image of pixels of type T and dimension 3, stored at an already allocated memory. Does not allocate fresh memory. Does not free given memory at object destruction unless handleDelete=true. This memory must indeed stay available during object life.

Parameters
ptraddress of memory
w,h,dimage size
handleDeletedelete memory at destruction? (default=false)
Image<byte,3> H(t1,2,3,1); // pre-allocated, 3D

◆ Image() [8/9]

template<typename T, int dim = 2>
Imagine::Image< T, dim >::Image ( const Base I)
inline

Constructs an image from another one (sharing memory!)

Parameters
Iimage to copy
Image<byte>I(E); // copy constructor

◆ Image() [9/9]

template<typename T, int dim = 2>
template<typename T2 >
Imagine::Image< T, dim >::Image ( const MultiArray< T2, dim > &  I)
inline

Constructs an image of type T from one of another type (thus without sharing memory!)

Parameters
Iimage to copy
Template Parameters
T2type of I
Image<byte>Jb(20,20); // from different type
for(int i=0; i<Jb.height(); i++)
for(int j=0; j<Jb.width(); j++)
Jb(j,i) = byte(rand()%256);
Image<double>Jd(Jb);
Image<Color>Jcb(20,20);
for(int i=0; i<Jcb.height(); i++)
for(int j=0; j<Jcb.width(); j++)
Jcb(j,i)=Color(byte(rand()%256),byte(rand()%256),byte(rand()%256));
Image<RGB<double> >Jcd(Jcb); // ...

◆ ~Image()

template<typename T, int dim = 2>
virtual Imagine::Image< T, dim >::~Image ( )
inlinevirtual

Reference counted desctructor: frees memory if the object is the last one to use it.

Member Function Documentation

◆ clone()

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::clone ( ) const
inline

Clones: creates a new image, with fresh memory, copying values to it

Returns
cloned image
A=E.clone(); // cloning (fresh memory)

◆ dirichlet()

template<typename T, int dim = 2>
T Imagine::Image< T, dim >::dirichlet ( const Coords< dim > &  c,
out = T(0) 
) const
inline

Acces with Dirichlet border conditions: I(x,y)=out if x<0, ...

Parameters
ccoordinates
outconstant (default=T(0))
Returns
value
a=I.dirichlet(-2,1);b=I.dirichlet(1,-2);c=I.dirichlet(4,1);d=I.dirichlet(1,4); // Dirichlet access

◆ fill()

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::fill ( x)
inline

Fills with constant value

Parameters
xvalue to be copied to each element
Returns
self reference
A.fill(12); // filling with constant value

◆ getSubImage() [1/3]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::getSubImage ( const Coords< dim > &  offset,
const Coords< dim > &  sz 
) const
inline

Constructs a sub image, i.e. a new one with fresh memory, initialized from a part of values of *this

Parameters
offsetcoordinates of first element
szsizes of sub image
Returns
sub image
A=C.getSubImage(Coords<2>(1,1),Coords<2>(10,10)); // sub image

◆ getSubImage() [2/3]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::getSubImage ( int  x,
int  y,
int  w,
int  h 
) const
inline

Construct a sub image, i.e. a new one with fresh memory, initialized from a part of values of *this

Parameters
x,ycoordinates of first element
w,hsizes of sub image
Returns
sub image
A=C.getSubImage(1,1,10,10); // sub image 2D

◆ getSubImage() [3/3]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::getSubImage ( int  x,
int  y,
int  z,
int  w,
int  h,
int  d 
) const
inline

Construct a sub image, i.e. a new one with fresh memory, initialized from a part of values of *this

Parameters
x,y,zcoordinates of first element
w,h,dsizes of sub image
Returns
sub image
H=D.getSubImage(1,1,1,10,10,10); // sub image 3D

◆ interpolate()

template<typename T, int dim = 2>
template<typename V >
PixelTraits<T>::template CastPixel<V>::value_type Imagine::Image< T, dim >::interpolate ( const FVector< V, dim > &  c) const
inline

Bilinear interpolation of a pixel value. Return type depends on coordinates type (e.g double coordinates yield double of RGB<double> value)

Template Parameters
Vcoordinates type
Parameters
ccoordinates
Returns
interpolated value
/*float v1=*/Jb.interpolate(1.2f,3.7f); // interpolation
/*RGB<double> v2=*/Jcb.interpolate(FVector<double,2>(1.2,3.7)); // ...

◆ invMirror()

template<typename T, int dim = 2>
T Imagine::Image< T, dim >::invMirror ( const Coords< dim > &  c) const
inline

Acces with inversed mirror border conditions: I(x,y)=2*I(0,y)-I(-x,y) if x<0, ...

Parameters
ccoordinates
Returns
value
a=I.invMirror(-2,1);b=I.invMirror(1,-2);c=I.invMirror(4,1);d=I.invMirror(1,4); // inversed mirror access

◆ mirror()

template<typename T, int dim = 2>
T Imagine::Image< T, dim >::mirror ( const Coords< dim > &  c) const
inline

Acces with mirror border conditions: I(x,y)=I(-x,y) if x<0, ...

Parameters
ccoordinates
Returns
value
a=I.mirror(-2,1);b=I.mirror(1,-2);c=I.mirror(4,1);d=I.mirror(1,4); // mirror access

◆ neumann()

template<typename T, int dim = 2>
T Imagine::Image< T, dim >::neumann ( const Coords< dim > &  c) const
inline

Acces with Neumann border conditions: I(x,y)=I(0,y) if x<0, ...

Parameters
ccoordinates
Returns
value
a=I.neumann(-2,1);b=I.neumann(1,-2);c=I.neumann(4,1);d=I.neumann(1,4); // Neumann access

◆ operator*() [1/2]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator* ( scalar_type  s) const
inline

Multiplication by a scalar

Parameters
sscalar factor
Returns
result
O=P*2.; // scalar *

◆ operator*() [2/2]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator* ( const Image< scalar_type, dim > &  B) const
inline

Pointwise multiplication by a scalar image

Parameters
Bscalar image
Returns
result
O=P*Q; // pointwise scalar *

◆ operator*=() [1/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator*= ( scalar_type  s)
inline

In place multiplication by a scalar

Parameters
sscalar factor
Returns
self reference
O*=2.; // scalar *=

◆ operator*=() [2/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator*= ( const Image< scalar_type, dim > &  B)
inline

In place pointwise multiplication by a scalar image

Parameters
Bscalar image
Returns
self reference
O*=Q; // pointwise scalar *=

◆ operator+() [1/2]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator+ ( const Image< T, dim > &  B) const
inline

Addition of two images

Parameters
Bimage to be added to myself
Returns
sum
O=O+P; // image +

◆ operator+() [2/2]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator+ ( v) const
inline

Addition of a constant

Parameters
vconstant to be added to myself
Returns
result
O=P+RGB<double>(1.,2.,3.); // constant +

◆ operator+=() [1/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator+= ( const Image< T, dim > &  B)
inline

In place Addition of two images

Parameters
Bimage to be added to myself
Returns
self reference
O+=P; // image +=

◆ operator+=() [2/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator+= ( v)
inline

In place addition of a constant

Parameters
vconstant to be added to myself
Returns
self reference
O+=RGB<double>(1.,2.,3.); // constant +=

◆ operator-() [1/3]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator- ( ) const
inline

Oppsite of an image

Returns
opposite
O=-O; // unary -

◆ operator-() [2/3]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator- ( const Image< T, dim > &  B) const
inline

Substraction of two images

Parameters
Bimage to be substracted from myself
Returns
difference
O=O-P; // image -

◆ operator-() [3/3]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator- ( v) const
inline

Substraction of a constant

Parameters
vconstant to be substracted from myself
Returns
result
O=P-RGB<double>(1.,2.,3.); // constant -

◆ operator-=() [1/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator-= ( const Image< T, dim > &  B)
inline

In place substraction of two images

Parameters
Bimage to be substracted from myself
Returns
self reference
O-=P; // image -=

◆ operator-=() [2/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator-= ( v)
inline

In place substraction of a constant

Parameters
vconstant to be substracted from myself
Returns
self reference
O-=RGB<double>(1.,2.,3.); // constant -=

◆ operator/() [1/2]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator/ ( scalar_type  s) const
inline

Division by a scalar

Parameters
sscalar factor
Returns
result
O=P/2.; // scalar /

◆ operator/() [2/2]

template<typename T, int dim = 2>
Image Imagine::Image< T, dim >::operator/ ( const Image< scalar_type, dim > &  B) const
inline

Pointwise division by a scalar image

Parameters
Bscalar image
Returns
result
O=P/Q; // pointwise scalar /

◆ operator/=() [1/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator/= ( scalar_type  s)
inline

In place division by a scalar

Parameters
sscalar factor
Returns
self reference
O/=2.; // scalar /=

◆ operator/=() [2/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator/= ( const Image< scalar_type, dim > &  B)
inline

In place pointwise division by a scalar image

Parameters
Bscalar image
Returns
self reference
O/=Q; // pointwise scalar /=

◆ operator=() [1/2]

template<typename T, int dim = 2>
Image& Imagine::Image< T, dim >::operator= ( const Base I)
inline

Assigns from image (sharing its memory)

Parameters
Iimage to be assigned to
Returns
self reference
A=E; // assignment

◆ operator=() [2/2]

template<typename T, int dim = 2>
template<typename T2 >
Image& Imagine::Image< T, dim >::operator= ( const MultiArray< T2, dim > &  I)
inline

Assign from an image of another type (thus without sharing memory!)

Parameters
Iimage to copy
Template Parameters
T2type of I
Returns
self reference
Jd=Jb; // different type assignment
Jcd=Jcb; // ...

Friends And Related Function Documentation

◆ norm

template<typename T, int dim = 2>
scalar_type norm ( const Image< T, dim > &  I)
friend

Euclidean norm of pixel values. Beware of overflow.

Parameters
Iargument
Returns
norm.
cout << norm2(Jd) << ' ' << norm2(Jcd) << endl; // squared Euclidean norm

◆ norm2

template<typename T, int dim = 2>
scalar_type norm2 ( const Image< T, dim > &  I)
friend

Squared Euclidean norm of pixel values, i.e the sum of the squared norm of pixels. Beware of overflow.

Parameters
Iargument
Returns
squared norm.

◆ operator*

template<typename T, int dim = 2>
Image operator* ( scalar_type  s,
const Image< T, dim > &  I 
)
friend

Multiplication by a scalar

Parameters
sscalar factor
Iimage
Returns
result
O=2*P; // scalar * image

◆ operator+

template<typename T, int dim = 2>
Image operator+ ( v,
const Image< T, dim > &  I 
)
friend

Addition of a constant

Parameters
vconstant to be added to I
Iimage
Returns
result
O=RGB<double>(1.,2.,3.)+P; // constant + image

◆ operator-

template<typename T, int dim = 2>
Image operator- ( v,
const Image< T, dim > &  I 
)
friend

Substraction of a constant

Parameters
vconstant from which I is to be substracted
Iimage
Returns
result
O=RGB<double>(1.,2.,3.)-P; // constant - image

◆ sum

template<typename T, int dim = 2>
T sum ( const Image< T, dim > &  I)
friend

Sum of pixel values. Beware of overflow.

Parameters
Iargument
Returns
sum
cout << sum(Jd) << ' ' << sum(Jcd) << endl; // sum of pixels


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