Skip to content

Instantly share code, notes, and snippets.

@connors511
Created September 21, 2011 16:26
Show Gist options
  • Save connors511/1232542 to your computer and use it in GitHub Desktop.
Save connors511/1232542 to your computer and use it in GitHub Desktop.
for (i = 0; i < LENGTH(iImage->Pixels); i++)
{
pixel = pos = 0;
for (row = -(m - 1)/2.0; row <= (m - 1)/2.0; row++)
{
for (col = -(m - 1)/2.0; col <= (m - 1)/2.0; col++)
{
pos = i + row * iImage->Width + col;
if (pos >= 0 && pos <= lastPixel) // Check for top and bottom
{
if (i % iImage->Width == 0 && (pos + 1) % iImage->Width != 0) // check left
{
pixel += F[row][col] * iImage->Pixels[pos];
}
else if ( (i + 1) % iImage->Width == 0 && pos % iImage->Width != 0) // check right
{
pixel += F[row][col] * iImage->Pixels[pos];
}
}
}
}
oImage->Pixels[i] = pixel / normalization;
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment