#include <HxImgFtorGenConv2d.h>
Inheritance diagram for HxImgFtorGenConv2d::
Public Types | |
typedef HxImgFtorGenConvKey | KeyType |
The key type of this class. More... | |
typedef SrcImgSigT::DataPtrType | SrcDataPtrType |
The data pointer type of the source image. More... | |
typedef KerImgSigT::DataPtrType | KerDataPtrType |
The data pointer type of the kernel image. More... | |
Public Methods | |
HxImgFtorGenConv2d () | |
Constructor. More... | |
virtual | ~HxImgFtorGenConv2d () |
Destructor. More... | |
Protected Methods | |
virtual void | doIt (DstDataPtrType dstPtr, SrcDataPtrType srcPtr, KerDataPtrType kerPtr, HxSizes dstSize, HxSizes srcSize, HxSizes kerSize, HxTagList &tags, HxImgFtorDescription *=0) |
The actual operation. More... |
|
The key type of this class.
Reimplemented from HxImgFtorI3Cast. |
|
The data pointer type of the source image.
|
|
The data pointer type of the kernel image.
|
|
Constructor.
00032 : HxImgFtorI3Cast<DstImgSigT, SrcImgSigT, KerImgSigT>( 00033 HxImgFtorGenConvKey(HxClassName<DstImgSigT>(), 00034 HxClassName<SrcImgSigT>(), HxClassName<KerImgSigT>(), 00035 HxClassName<PixOpT>(), HxClassName<RedOpT>(), 00036 HxClassName<KernelT>())) 00037 { 00038 #ifdef CD_TRACE 00039 HxEnvironment::instance()->outputStream() 00040 << "HxImgFtorGenConv2d::HxImgFtorGenConv2d()" << STD_ENDL; 00041 #endif 00042 } |
|
Destructor.
00048 { 00049 #ifdef CD_TRACE 00050 HxEnvironment::instance()->outputStream() 00051 << "HxImgFtorGenConv2d::~HxImgFtorGenConv2d()" << STD_ENDL; 00052 #endif 00053 } |
|
The actual operation.
00064 { 00065 int imgWidth = dstSize.x(); 00066 int imgHeight = dstSize.y(); 00067 int kerWidth = kerSize.x(); 00068 int kerHeight = kerSize.y(); 00069 int x, y, i, j; 00070 00071 PixOpT pixOp(tags); 00072 RedOpT redOp(tags); 00073 KernelT kernel(kerPtr, kerSize, tags); 00074 00075 typedef typename KerImgSigT::ArithType ArithType; 00076 ArithType result, tmpVal, neutralElement(RedOpT::neutralElement()); 00077 00078 for (y=0 ; y<imgHeight ; y++) { 00079 DstDataPtrType dPtr = dstPtr; 00080 dPtr.incY(y); 00081 for (x=0 ; x<imgWidth ; x++) { 00082 SrcDataPtrType sPtr = srcPtr; 00083 sPtr.incXYZ(x, y); 00084 result = neutralElement; 00085 for (j=0 ; j<kerHeight ; j++) { 00086 for (i=0 ; i<kerWidth ; i++) { 00087 tmpVal = pixOp.doIt(sPtr.readIncX(), kernel(i,j)); 00088 redOp.doIt(result, tmpVal); 00089 } 00090 sPtr.decX(kerWidth); 00091 sPtr.incY(); 00092 } 00093 dPtr.writeIncX(result); 00094 } 00095 } 00096 } |