Beispiel #1
0
static void ApplyAverageBlurFilter(PBYTE frameData, PBITMAPINFO frameInfo, PBYTE targetBuffer) 
{
	LONG width = frameInfo->bmiHeader.biWidth;
	LONG height = frameInfo->bmiHeader.biHeight;

	for (int x=1; x < width-1; x++)
	{
		for (int y=1; y < height-1; y++)
		{
			// Calculate average of all pixels in a 3x3 rectangle around (x, y)
			targetBuffer[x + y*width] = (
				GetPixelAt(frameData, x-1, y-1, height) + GetPixelAt(frameData, x, y-1, height) + GetPixelAt(frameData, x+1, y-1, height) + 
				GetPixelAt(frameData, x-1, y, height) + GetPixelAt(frameData, x, y, height) + GetPixelAt(frameData, x+1, y, height) + 
				GetPixelAt(frameData, x-1, y+1, height) + GetPixelAt(frameData, x, y+1, height) + GetPixelAt(frameData, x+1, y+1, height)
				) / 9;
		}
	}
}
Beispiel #2
0
 PixelColor::Enum PotraceImage::RB(Imaging::image_size_t x, Imaging::image_size_t y) const {
     return GetPixelAt(x, y, 1, 1);
 }