24 magnitudeSqrTable (NULL),
31 DeleteMagnitudeSqrTable ();
36 if (magnitudeSqrTable)
38 for (
kkuint32 r = 0; r < magnitudeSqrTableHeight; ++r)
39 delete magnitudeSqrTable[r];
40 delete magnitudeSqrTable;
41 magnitudeSqrTable = NULL;
43 magnitudeSqrTableHeight = 0;
44 magnitudeSqrTableWidth = 0;
49 DeleteMagnitudeSqrTable ();
56 magnitudeSqrTable =
new kkint32*[magnitudeSqrTableHeight];
58 for (r = 0; r < magnitudeSqrTableHeight; ++r)
59 magnitudeSqrTable[r] =
new kkint32[magnitudeSqrTableWidth];
67 bool weOwnRaster =
false;
76 BuildMagnitudeSqrTable ();
82 return BuildMagnitudeImage();
87 if ((
srcHeight != magnitudeSqrTableHeight) || (
srcWidth != magnitudeSqrTableWidth))
88 AllocateMagnitudeSqrTable ();
90 uchar* lastRow = NULL;
91 uchar* thisRow = NULL;
92 uchar* nextRow = NULL;
107 for (c = 1; c < (
srcWidth - 1); c++)
109 v = (-1 * lastRow[c - 1]) + (-2 * lastRow[c]) + (-1 * lastRow[c + 1]) +
110 ( 1 * nextRow[c - 1]) + ( 2 * nextRow[c]) + ( 1 * nextRow[c + 1]);
112 h = (-1 * lastRow[c - 1]) + (1 * lastRow[c + 1]) +
113 (-2 * thisRow[c - 1]) + (2 * thisRow[c + 1]) +
114 (-1 * nextRow[c - 1]) + (1 * nextRow[c + 1]);
116 magnitude = (v * v + h * h);
117 if (magnitude > maxMagnitude)
118 maxMagnitude = magnitude;
120 magnitudeSqrTable[r][c] = magnitude;
146 float maxMagnitudeFloat = sqrt ((
float)maxMagnitude);
150 for (c = 1; c < (
srcWidth - 1); ++c)
152 if (maxMagnitude > 0.0f)
153 adjMag = 255.0f * sqrt ((
float)magnitudeSqrTable[r][c]) / maxMagnitudeFloat;
157 float pixelWorkVal = adjMag + (
float)0.5;
158 if (pixelWorkVal > 255.0f)
159 pixelWorkVal = 255.0f;
void SetSrcRaster(RasterConstPtr _srcRaster)
RasterPtr CreateGrayScaleKLT() const
Creates a image using a KLT Transform with the goal of weighting in favor the color channels with gre...
void SetPixelValue(kkint32 row, kkint32 col, uchar pixVal)
A class that is used by to represent a single image in memory.
unsigned __int32 kkuint32
unsigned char uchar
Unsigned character.
Raster(kkint32 _height, kkint32 _width, bool _color)
Constructs a blank image with given dimensions.
virtual RasterPtr PerformOperation(Raster const *_image)