26 #include "FilterNTo2N.hh"
34 #include <Base/Common/BIASpragma.hh>
36 template <
class InputStorageType,
class OutputStorageType>
39 :
FilterBase<InputStorageType, OutputStorageType>()
44 template <
class InputStorageType,
class OutputStorageType>
47 : _VecLengthType(_VecLengthType)
51 template <
class InputStorageType,
class OutputStorageType>
56 template <
class InputStorageType,
class OutputStorageType>
64 template <
class InputStorageType,
class OutputStorageType>
72 template <
class InputStorageType,
class OutputStorageType>
80 template <
class InputStorageType,
class OutputStorageType>
89 template <
class InputStorageType,
class OutputStorageType>
98 template <
class InputStorageType,
class OutputStorageType>
112 template <
class InputStorageType,
class OutputStorageType>
119 switch (_VecLengthType){
121 res=VecLenL1(gx, gy, absg);
124 res=VecLenL2(gx, gy, absg);
127 res=VecLenMax(gx, gy, absg);
130 BIASERR(
"unknown VecLengthType "<<_VecLengthType);
138 template <
class InputStorageType,
class OutputStorageType>
144 BIASCDOUT(D_FILTERBASE_CALLSTACK,
"FilterNTo2N::VecLenL1\n");
145 unsigned htlx, htly, hbrx, hbry, vtlx, vtly, vbrx, vbry;
148 const int minx=(htlx<vtlx)?vtlx:htlx;
149 const int miny=(htly<vtly)?vtly:htly;
150 const int maxx=(hbrx>vbrx)?vbrx:hbrx;
151 const int maxy=(hbry>vbry)?vbry:hbry;
158 for (y=miny; y<maxy; y++){
159 for (x=minx; x<maxx; x++){
160 absi[y][x]=(OutputStorageType)(fabs((
double)(gxi[y][x]))+
161 fabs((
double)(gyi[y][x])));
170 template <
class InputStorageType,
class OutputStorageType>
176 BIASCDOUT(D_FILTERBASE_CALLSTACK,
"FilterNTo2N::VecLenL2\n");
177 unsigned htlx, htly, hbrx, hbry, vtlx, vtly, vbrx, vbry;
180 const int minx=(htlx<vtlx)?vtlx:htlx;
181 const int miny=(htly<vtly)?vtly:htly;
182 const int maxx=(hbrx>vbrx)?vbrx:hbrx;
183 const int maxy=(hbry>vbry)?vbry:hbry;
190 for (y=miny; y<maxy; y++){
191 for (x=minx; x<maxx; x++){
193 (OutputStorageType)sqrt((
double)(gxi[y][x])*(
double)(gxi[y][x])+
194 (
double)(gyi[y][x])*(
double)(gyi[y][x]));
203 template <
class InputStorageType,
class OutputStorageType>
209 BIASCDOUT(D_FILTERBASE_CALLSTACK,
"FilterNTo2N::VecLenMax\n");
210 unsigned htlx, htly, hbrx, hbry, vtlx, vtly, vbrx, vbry;
213 const int minx=(htlx<vtlx)?vtlx:htlx;
214 const int miny=(htly<vtly)?vtly:htly;
215 const int maxx=(hbrx>vbrx)?vbrx:hbrx;
216 const int maxy=(hbry>vbry)?vbry:hbry;
223 for (y=miny; y<maxy; y++){
224 for (x=minx; x<maxx; x++){
225 absi[y][x]=(gxi[y][x]>=gyi[y][x])?(gxi[y][x]):(gyi[y][x]);
235 #define FILTER_INSTANTIATION_CLASS FilterNTo2N
236 #define FILTER_INSTANTIATION_NO_UNSIGNED_OUTPUT
237 #include "Filterinst.hh"
int VecLenL2(const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
length = sqrt(gx*gx+gy*gy) destination absg must be initialized
virtual int Filter(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
dst.GetChannelCount()==2*src.GetCHannelCount()
int SetCorners(unsigned UpperLeftX, unsigned UpperLeftY, unsigned LowerRightX, unsigned LowerRightY)
Sets a rectangular region of interest.
void GetCorners(unsigned &UpperLeftX, unsigned &UpperLeftY, unsigned &LowerRightX, unsigned &LowerRightY) const
Return the region of interest, by saving the coordinates within the variables defined by the paramete...
int VecLenL1(const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
length = | fabs(gx) + fabs(gy) | destination absg must be initialized
virtual parent class for API definition of all (future) filters
int VecLen(const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
decides which vector length to use from *_VecLenthType
int VecLenMax(const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
length = max(fabs(gx),fabs(gy)) destination absg must be initialized
virtual int FilterInt(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
ROI * GetROI()
Returns a pointer to the roi object.
int _VecLengthType
of type Gradient<InputStorageType, OutputStorageType>::EVecLengthType
virtual int FilterFloat(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
const StorageType ** GetImageDataArray() const
overloaded GetImageDataArray() from ImageBase