Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxFuncRecGenConv2d.c File Reference

More...

#include "HxFuncRecGenConv2d.h"
#include "HxEnvironment.h"

Functions

template<class DataPtrType, class KerDataPtrType, class ArithType, class PixOpT, class RedOpT> void HxFuncRecGenConv2d_XYdirSim (DataPtrType imgPtr, KerDataPtrType kerPtr, ArithType dummy, HxSizes imgSize, HxSizes kerSize, PixOpT &pixOp, RedOpT &redOp)
 RecGenConv2d : XY direction, simple. More...

template<class DataPtrType, class KerDataPtrType, class ArithType, class PixOpT, class RedOpT> void HxFuncRecGenConv2dDispatch (DataPtrType imgPtr, KerDataPtrType kerPtr, ArithType dummy, HxSizes imgSize, HxSizes kerSize, PixOpT &pixOp, RedOpT &redOp)
 Dispatch function for RecGenConv2d. More...


Detailed Description


Function Documentation

template<class DataPtrType, class KerDataPtrType, class ArithType, class PixOpT, class RedOpT>
void HxFuncRecGenConv2d_XYdirSim DataPtrType    imgPtr,
KerDataPtrType    kerPtr,
ArithType    dummy,
HxSizes    imgSize,
HxSizes    kerSize,
PixOpT &    pixOp,
RedOpT &    redOp
 

RecGenConv2d : XY direction, simple.

00026 {
00027     int kerWidth = kerSize.x();
00028     int kerHeight = kerSize.y();
00029     int x, y, i, j;
00030     int borderWidth = kerWidth/2;
00031     int borderHeight = kerHeight/2;
00032     imgSize = imgSize - HxSizes(2*borderWidth, 2*borderHeight, 0);
00033     int imgWidth = imgSize.x();
00034     int imgHeight = imgSize.y();
00035 
00036     ArithType result, tmpVal, neutralElement(RedOpT::neutralElement());
00037 
00038     // scan order
00039 
00040     DataPtrType iPtr = imgPtr;
00041     for (y=0 ; y<imgHeight ; y++) {
00042         for (x=0 ; x<imgWidth ; x++) {
00043             DataPtrType nPtr = iPtr;
00044             KerDataPtrType kPtr = kerPtr;
00045             result = neutralElement;
00046             for (j=0 ; j<borderHeight ; j++) {
00047                 for (i=0 ; i<kerWidth ; i++) {
00048                     tmpVal = pixOp.doIt(nPtr.readIncX(), kPtr.readIncX());
00049                     redOp.doIt(result, tmpVal);
00050                 }
00051                 nPtr.decX(kerWidth);
00052                 nPtr.incY();
00053             }
00054             for (i=0 ; i<=borderWidth ; i++) {
00055                 tmpVal = pixOp.doIt(nPtr.readIncX(), kPtr.readIncX());
00056                 redOp.doIt(result, tmpVal);
00057             }
00058             nPtr.decX();
00059             nPtr.write(result);
00060             iPtr.incX();
00061         }
00062         iPtr.decX(imgWidth);
00063         iPtr.incY();
00064     }
00065 
00066     // anti scan order
00067 
00068     iPtr = imgPtr;
00069     iPtr.incXYZ(borderWidth+imgWidth+borderWidth-1,
00070                 borderHeight+imgHeight+borderHeight-1, 0);
00071     for (y=0 ; y<imgHeight ; y++) {
00072         for (x=0 ; x<imgWidth ; x++) {
00073             DataPtrType nPtr = iPtr;
00074             KerDataPtrType kPtr = kerPtr;
00075             kPtr.incX(kerWidth-1);
00076             kPtr.incY(kerHeight-1);
00077             result = neutralElement;
00078             for (j=0 ; j<borderHeight ; j++) {
00079                 for (i=0 ; i<kerWidth ; i++) {
00080                     tmpVal = pixOp.doIt(nPtr.read(), kPtr.read());
00081                     redOp.doIt(result, tmpVal);
00082                     nPtr.decX(); kPtr.decX();
00083                 }
00084                 nPtr.incX(kerWidth);
00085                 nPtr.decY();
00086             }
00087             for (i=0 ; i<=borderWidth ; i++) {
00088                 tmpVal = pixOp.doIt(nPtr.read(), kPtr.read());
00089                 redOp.doIt(result, tmpVal);
00090                 nPtr.decX(); kPtr.decX();
00091             }
00092             nPtr.incX();
00093             nPtr.write(result);
00094             iPtr.decX();
00095         }
00096         iPtr.incX(imgWidth);
00097         iPtr.decY();
00098     }
00099 }

template<class DataPtrType, class KerDataPtrType, class ArithType, class PixOpT, class RedOpT>
void HxFuncRecGenConv2dDispatch DataPtrType    imgPtr,
KerDataPtrType    kerPtr,
ArithType    dummy,
HxSizes    imgSize,
HxSizes    kerSize,
PixOpT &    pixOp,
RedOpT &    redOp
 

Dispatch function for RecGenConv2d.

Assertions:

Parameters:
imgPtr  Input/Output image: IS = imgSize, IBS = kerSize/2, imgPtr is at (IX0,IY0)
kerPtr  Input image, IS = kerSize, IBS = 0

00115 {
00116     HxFuncRecGenConv2d_XYdirSim(imgPtr, kerPtr, dummy, imgSize,
00117                                 kerSize, pixOp, redOp);
00118 }


Generated on Tue Feb 3 14:18:47 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001