43 float cellStart = (
float)cellIdx * factor;
44 float cellEnd = (
float)(cellIdx + 1) * factor;
49 if (cellEnd > floor(cellEnd))
58 float cellValue = cellStart;
59 float nextCellValue = cellStart;
62 if (cellValue < ceil (cellValue))
63 nextCellValue = Min (cellEnd, ceilf (cellValue));
65 nextCellValue = Min (cellEnd, ceilf (cellValue + 1.0f));
67 float fract = nextCellValue - cellValue;
70 cellValue = nextCellValue;
85 rowFactor (_rowFactor),
86 colFactor (_colFactor),
98 delete[] rowFactors; rowFactors = NULL;
99 delete[] colFactors; colFactors = NULL;
106 kkint32 result =
sizeof (*
this) +
125 RasterPtr result =
new Raster (destHeight
, destWidth
, color
);
137 uchar* srcRedRow = NULL;
139 uchar* srcBlueRow = NULL;
142 srcRedRow =
srcRed [srcRow];
155 uchar srcPixelRed = 0;
156 uchar srcPixelGreen = srcGreenRow[srcCol];
157 uchar srcPixelBlue = 0;
160 srcPixelRed = srcRedRow [srcCol];
161 srcPixelBlue = srcBlueRow[srcCol];
171 destGreen[destRow][destCol] += (uchar)Min (255.0f, srcPixelGreen * destRowFract * destColFract);
174 destRed [destRow][destCol] += (uchar)Min (255.0f, srcPixelRed * destRowFract * destColFract);
175 destBlue[destRow][destCol] += (uchar)Min (255.0f, srcPixelBlue * destRowFract * destColFract);
193 CellFactorPtr cellFactors =
new CellFactor[cellFactorsCount];
195 for (
kkuint32 x = 0; x < cellFactorsCount; ++x)
209 if ((height + 1) > rowFactorsCount)
214 rowFactors = BuildCellFactors (rowFactor, height + 5);
215 rowFactorsCount = height + 5;
218 if ((width + 1) > colFactorsCount)
222 colFactors = BuildCellFactors (colFactor, width + 5);
223 colFactorsCount = width + 5;
void SetSrcRaster(RasterConstPtr _srcRaster)
virtual ~MorphOpStretcher()
void BackgroundPixelTH(uchar _backgroundPixelTH)
void BackgroundPixelValue(uchar _backgroundPixelValue)
uchar BackgroundPixelValue() const
unsigned __int16 kkuint16
16 bit unsigned integer.
A class that is used by to represent a single image in memory.
unsigned __int32 kkuint32
virtual RasterPtr PerformOperation(RasterConstPtr _image)
uchar ForegroundPixelValue() const
void UpdateForSourceCellIdx(kkuint32 cellIdx, float factor)
void ForegroundPixelValue(uchar _foregroundPixelValue)
kkint32 MemoryConsumedEstimated()
MorphOpStretcher(float _rowFactor, float _colFactor)
unsigned char uchar
Unsigned character.
uchar BackgroundPixelTH() const
Raster(kkint32 _height, kkint32 _width, bool _color)
Constructs a blank image with given dimensions.
Base class for all Morphological operations.