golib  0.5
goSignal2D< T > Class Template Reference

Public Member Functions

 goSignal2D (goSize_t width, goSize_t height, goSize_t border_x=16, goSize_t border_y=16, goSize_t blockWidth=GOSIGNAL_BLOCKSIZE_X, goSize_t blockHeight=GOSIGNAL_BLOCKSIZE_Y)
 
T * getPtr (goIndex_t x, goIndex_t y)
 
T * getPtrStart ()
 
goIndex_t getBorderX ()
 
goIndex_t getBorderY ()
 
goSize_t getSizeX ()
 
goSize_t getSizeY ()
 
goPtrOffset_t getOffsetX ()
 Currently just returns 1.
 
goPtrOffset_t getOffsetY ()
 
void resize (goSize_t width, goSize_t height)
 
goSignal2D< T > & operator-= (goSignal2D< T > &other)
 Subtracts other from this.
 
goSignal2D< T > & operator+= (goSignal2D< T > &other)
 Adds other to this.
 
goSignal2D< T > & operator*= (T value)
 Multiply all samples with value.
 
goSignal2D< T > & operator= (goSignal2D< T > &other)
 Copy operator (deep copy).
 
meanDiff (goSignal2D< T > &other, goIndex_t xrel, goIndex_t yrel)
 
void fill (T val)
 
void put (goSignal2D< T > &s, goIndex_t x, goIndex_t y)
 
void interpolateBorders (bool interpolate=false)
 
void interpolateBorders (goIndex_t xleft, goIndex_t xright, goIndex_t yup, goIndex_t ydown)
 
void interpolateBordersPeriodic ()
 
void sample (goFloat x, goFloat y, goFloat &c)
 
goSize_t memoryUsage () const
 Returns the size of this object or some measure of its memory consumption. More...
 

Protected Attributes

goSize_t sizeX
 
goSize_t sizeY
 
goSize_t blockSizeX
 
goSize_t blockSizeY
 
goIndex_t borderX
 
goIndex_t borderY
 
goArray< T > * data
 
goSize_t total_memory_usage
 

Constructor & Destructor Documentation

◆ goSignal2D()

template<class T >
goSignal2D< T >::goSignal2D ( goSize_t  width,
goSize_t  height,
goSize_t  border_x = 16,
goSize_t  border_y = 16,
goSize_t  blockWidth = GOSIGNAL_BLOCKSIZE_X,
goSize_t  blockHeight = GOSIGNAL_BLOCKSIZE_Y 
)

blockSizes are in number of shifts and not used yet ! For now, data is stored linearly.

Member Function Documentation

◆ fill()

template<class T>
void goSignal2D< T >::fill ( val)

m: 3x3 transformation matrix applied to other

◆ getOffsetY()

template<class T >
goPtrOffset_t goSignal2D< T >::getOffsetY ( )
Returns
Pointer distance between point (x, y) and (x, y + 1)

◆ getPtr()

template<class T >
T * goSignal2D< T >::getPtr ( goIndex_t  x,
goIndex_t  y 
)

Get Ptr to point [x,y].
Uses Multiplication, so don't use excessively yet !

Returns
Pointer to point [x,y]

◆ getPtrStart()

template<class T >
T * goSignal2D< T >::getPtrStart ( )
Returns
Pointer to point [0,0]

◆ interpolateBorders() [1/2]

template<class T >
void goSignal2D< T >::interpolateBorders ( bool  interpolate = false)

Interpolates the signal into the borders (only one sample wide so far). The argument does nothing at the moment, the neighbouring value is simply copied.

◆ interpolateBorders() [2/2]

template<class T >
void goSignal2D< T >::interpolateBorders ( goIndex_t  xleft,
goIndex_t  xright,
goIndex_t  yup,
goIndex_t  ydown 
)

Copy lines from offset xleft to the the -1st column, xright to the sizeX'st column and same in y direction. (Introduced for upsampled signals).

◆ meanDiff()

template<class T>
T goSignal2D< T >::meanDiff ( goSignal2D< T > &  other,
goIndex_t  xrel,
goIndex_t  yrel 
)

Calculates the mean difference between other and this. Other's upper left corner lies at (xrel, yrel) relative this' upper left corner. TO DO: calculate the deviation of the mean difference (to detect brighness differences).

other lies on this, (xrel,yrel) denotes the upper left corner of other relative to this. (this' upper left corner lies in (0,0), coordinates are like screen coordinates)

◆ memoryUsage()

template<class T>
goSize_t goSignal2D< T >::memoryUsage ( ) const
inlinevirtual

Returns the size of this object or some measure of its memory consumption.

Overload this function as you please and as it makes sense.

Returns
Size in bytes of this object.

Reimplemented from goObjectBase.

◆ resize()

template<class T >
void goSignal2D< T >::resize ( goSize_t  width,
goSize_t  height 
)

Resizing the 2D signal. The signal itself is stored in the "upper left" corner of the new resized signal.
Speed: slow. Tested: no.

◆ sample()

template<class T >
void goSignal2D< T >::sample ( goFloat  x,
goFloat  y,
goFloat &  c 
)
inline

Bilinear interpolation


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