Changes

Jump to: navigation, search

BETTERRED

1,254 bytes removed, 02:53, 26 February 2017
Hotspot
void BlurImage(const SImageData& srcImage, SImageData &destImage, float xblursigma, float yblursigma, unsigned int xblursize, unsigned int yblursize)
{
// allocate space for copying the image for destImage and tmpImage destImage.m_width = srcImage.m_width; destImage.m_height = srcImage.m_height; destImage.m_pitch = srcImage.m_pitch; destImage.m_pixels.resize(destImage.m_height * destImage.m_pitch);  SImageData tmpImage; tmpImage.m_width = srcImage.m_width; tmpImage.m_height = srcImage.m_height; tmpImage.m_pitch = srcImage.m_pitch; tmpImage.m_pixels.resize(tmpImage.m_height * tmpImage.m_pitch);
// horizontal blur from srcImage into tmpImage
auto row = GaussianKernelIntegrals(xblursigma, xblursize);
int startOffset = -1 * int(row// ...size() / 2);
for (int y = 0; y < tmpImage.m_height; ++y)
{
const uint8_t *pixel = GetPixelOrBlack(srcImage, x + startOffset + i, y);
blurredPixel[0] += float(pixel[0]) * row[i]; blurredPixel[1] += float(pixel[1]) * row[i]; blurredPixel[2] += float(pixel[2]) * row[i];// ...
}
uint8_t *destPixel = &tmpImage// ..m_pixels[y * tmpImage.m_pitch + x * 3];  destPixel[0] = uint8_t(blurredPixel[0]); destPixel[1] = uint8_t(blurredPixel[1]); destPixel[2] = uint8_t(blurredPixel[2]);
}
}
auto row = GaussianKernelIntegrals(yblursigma, yblursize);
int startOffset = -1 * int(row// ...size() / 2);
for (int y = 0; y < destImage.m_height; ++y)
{
const uint8_t *pixel = GetPixelOrBlack(tmpImage, x, y + startOffset + i);
blurredPixel[0] += float(pixel[0]) * row[i]; blurredPixel[1] += float(pixel[1]) * row[i]; blurredPixel[2] += float(pixel[2]) * row[i];// ...
}
uint8_t *destPixel = &destImage// ..m_pixels[y * destImage.m_pitch + x * 3];  destPixel[0] = uint8_t(blurredPixel[0]); destPixel[1] = uint8_t(blurredPixel[1]); destPixel[2] = uint8_t(blurredPixel[2]);
}
}
147
edits

Navigation menu