Skip to content

Instantly share code, notes, and snippets.

@walidvb
Created January 22, 2013 13:17
Show Gist options
  • Save walidvb/4594606 to your computer and use it in GitHub Desktop.
Save walidvb/4594606 to your computer and use it in GitHub Desktop.
Image RDC::compensate(const Image& srcImg)
{
Image dstImg(srcImg.width, srcImg.height);
for (int i = 0; i < srcImg.width; i++)
{
for (int j = 0 ; j < srcImg.height; j++)
{
float newPix = 0;
//Simple fixed threshold method
if (srcImg.pixelAt(i,j) > 127)
{
newPix = 255;
}
dstImg.pixelWrite(newPix, i, j);
//cout << dstImg.pixelAt(i,j) << " ";
}
//cout << endl;
}
return dstImg;
//TODO compensate #1 test with dummy matrix
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment