26 #include "HessianSimple.hh"
27 #include "FilterMask.hh"
34 #define POLAR_TABLE_OFFSET 128
35 #define POLAR_TABLE_SIZE 257
39 template <
class InputStorageType,
class OutputStorageType>
void
56 template <
class InputStorageType,
class OutputStorageType>
59 :
FilterNTo3N<InputStorageType, OutputStorageType>()
64 template <
class InputStorageType,
class OutputStorageType>
73 template <
class InputStorageType,
class OutputStorageType>
80 template <
class InputStorageType,
class OutputStorageType>
85 BIASCDOUT(D_FILTERBASE_CALLSTACK,
"HessianSimple::Filter(src, gx, gy)\n");
97 if (_Conv.CalculationInFloat()){
98 res = SimpleGreyValidFloat_(src, hxx, hyy);
100 res = SimpleGreyValidInt_(src, hxx, hyy);
104 BIASERR(
"not for multiple channel images");
110 template <
class InputStorageType,
class OutputStorageType>
115 BIASCDOUT(D_FILTERBASE_CALLSTACK,
116 "HessianSimple::Filter(src, hxx, hyyy, hxy)\n");
123 res = Filter(src, hxx, hyy);
128 for(
unsigned int x=0;x<hxx.
GetWidth();x++){
129 for(
unsigned int y=0;y<hxx.
GetHeight();y++){
130 idaHxy[y][x] = idaHxx[y][x] + idaHyy[y][x];
134 return (res==0)?0:-1;
140 template <
class InputStorageType,
class OutputStorageType>
146 BIASCDOUT(D_FILTERBASE_CALLSTACK,
"HessianSimple::SimpleGreyValidFloat_\n");
150 const int width=(int)src.
GetWidth();
151 const int nwidth = - width;
158 BIASASSERT(_Conv.CalculationInFloat());
161 int minx, miny, maxx, maxy;
168 OutputStorageType *pgx, *pgy, *end2, *lend2;
171 int step=width-maxx+minx;
173 offset=minx+1+(miny+1)*width;
174 const InputStorageType *ph = src.
GetImageData() + offset;
178 end2=gx+maxx+width*(maxy-2)-1;
179 lend2=gx+maxx+width*(miny+1)-1;
182 *pgx++ = (OutputStorageType)(ph[1] - ph[-1])/
183 (OutputStorageType)2;
184 *pgy++ = (OutputStorageType)(ph[width] - ph[nwidth])/
185 (OutputStorageType)2;
197 template <
class InputStorageType,
class OutputStorageType>
203 BIASCDOUT(D_FILTERBASE_CALLSTACK,
"HessianSimple::SimpleGreyValidInt_\n");
207 const int width=(int)src.
GetWidth();
208 const int nwidth = - width;
215 BIASASSERT(!_Conv.CalculationInFloat());
220 int minx, miny, maxx, maxy;
227 OutputStorageType *pgx, *pgy, *end2, *lend2;
230 int step=width-maxx+minx;
232 offset=minx+1+(miny+1)*width;
233 const InputStorageType * ph = src.
GetImageData()+offset;
238 end2=gx+maxx+width*(maxy-2)-1;
239 lend2=gx+maxx+width*(miny+1)-1;
242 *pgx++ = (OutputStorageType)(ph[1] - ph[-1])/
243 (OutputStorageType)2;
244 *pgy++ = (OutputStorageType)(ph[width] - ph[nwidth])/
245 (OutputStorageType)2;
258 template <
class InputStorageType,
class OutputStorageType>
262 _Conv.GetBorders(border_x, border_y);
268 #define FILTER_INSTANTIATION_CLASS HessianSimple
269 #define FILTER_INSTANTIATION_NO_UNSIGNED_OUTPUT
270 #include "Filterinst.hh"
void Release()
reimplemented from ImageBase
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...
bool IsEmpty() const
check if ImageData_ points to allocated image buffer or not
virtual int Filter(const Image< InputStorageType > &src, Image< OutputStorageType > &hxx, Image< OutputStorageType > &hyx)
HessianSimple(bool BuildPCM=false)
void CreateFloatFilter()
create the float filter from the int filter
virtual void GetBordersValid_(int &border_x, int &border_y) const
int SimpleGreyValidFloat_(const Image< InputStorageType > &src, Image< OutputStorageType > &gWE, Image< OutputStorageType > &gNS)
loop unrolled fast float version for [1 0 -1]
unsigned int GetWidth() const
int SimpleGreyValidInt_(const Image< InputStorageType > &src, Image< OutputStorageType > &gWE, Image< OutputStorageType > &gNS)
loop unrolled fast int version [1 0 -1]
simple hessian calculation hxx(x,y) = Hessian in x direction hyy(x,y) = Hessian in y direction ...
ROI * GetROI()
Returns a pointer to the roi object.
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
bool SamePixelAndChannelCount(const ImageBase &Image) const
checks if data area has same "size" as Image of other type
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
void InitKernel_()
sets the sobel kernel for the convolution object
A filter mask (or a kernel) used for convolution.
base class for simple n->3n filter implementations
const StorageType ** GetImageDataArray() const
overloaded GetImageDataArray() from ImageBase