works well for byte pixels :
-------------------------------------
#define rint(x) (floor((x)+0.5f))
unsigned char CPosterizeImp::PosterizePixel(unsigned char u_value, int iLevels )
{
double dblValue;
dblValue = (float)u_value/255.0;
dblValue = rint(dblValue * (iLevels - 1.0)) / (iLevels - 1.0);
return (unsigned char)(dblValue * 255.0);
}
Friday, May 11, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment