1 #include "IntegralImage.hh"
6 template<
class StorageType>
14 template<
class StorageType>
23 template<
class StorageType>
25 if (intImg_ != NULL)
delete[] intImg_;
28 template<
class StorageType>
50 intImg_[0] = (double)idaIn[0][0];
53 for (
unsigned int x=1; (int)x < width_; x++)
54 intImg_[x] = (
double)idaIn[0][x*channels_]+intImg_[x-1];
57 for (
unsigned int y=1; (int)y < height_; y++)
58 intImg_[y*width_] = (
double)idaIn[y][0]+intImg_[(y-1)*width_];
62 for (
unsigned int y=1; (int)y < height_; y++)
63 for (
unsigned int x=1; (int)x < width_; x++)
64 intImg_[y*width_+x] = (
double)idaIn[y][x*channels_]+intImg_[(y-1)*width_+x]
65 +intImg_[y*width_+(x-1)] - intImg_[(y-1)*width_+(x-1)];
69 template<
class StorageType>
73 if (halfLevelSize <= 0 || x - halfLevelSize*2 < 0 || y - halfLevelSize*2 < 0 || x + halfLevelSize*2 +1 >= (
int)width_ || y + halfLevelSize*2 +1>= (
int)height_)
77 double innerValueSum = GetAreaSum(x-halfLevelSize,y-halfLevelSize,x+halfLevelSize+1,y+halfLevelSize+1);
79 double completeValueSum = GetAreaSum(x-(halfLevelSize*2),y-(halfLevelSize*2),x+(halfLevelSize*2)+1,y+(halfLevelSize*2)+1);\
81 double outerValueSum = completeValueSum - innerValueSum;
83 double numOfInnerElements = (halfLevelSize*2+1)*(halfLevelSize*2+1);
84 double numOfOuterElements = (halfLevelSize*4+1)*(halfLevelSize*4+1) - numOfInnerElements;
86 return (innerValueSum/numOfInnerElements) - (outerValueSum/numOfOuterElements);
91 #define INSTANCE_IntImage(type)\
92 template class BIASUtils_EXPORT IntegralImage<type>;
96 INSTANCE_IntImage(
unsigned char)
97 INSTANCE_IntImage(
float)
98 #ifdef BUILD_IMAGE_INT
99 INSTANCE_IntImage(
int)
101 #ifdef BUILD_IMAGE_CHAR
102 INSTANCE_IntImage(
char)
104 #ifdef BUILD_IMAGE_SHORT
105 INSTANCE_IntImage(
short)
107 #if defined(BUILD_IMAGE_USHORT)
108 INSTANCE_IntImage(
unsigned short)
110 #ifdef BUILD_IMAGE_DOUBLE
111 INSTANCE_IntImage(
double)
113 #ifdef BUILD_IMAGE_UINT
114 INSTANCE_IntImage(
unsigned int)
unsigned int GetWidth() const
void ** GetImageDataArray() const
Get an array of pointers to image data.
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
The image template class for specific storage types.
This is the base class for images in BIAS.