Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

void GBitmap::binarize_grays ( int  threshold = 0  ) 

Binarizes a gray level image using a threshold. The number of gray levels is reduced to #2# as in a bilevel image. All pixels whose value was strictly greater than threshold# are set to black. All other pixels are set to white.

Definition at line 517 of file GBitmap.cpp.

References monitor().

{
  GMonitorLock lock(monitor());
  if (bytes)
    for (int row=0; row<nrows; row++)
      {
        unsigned char *p = (*this)[row];
        for(unsigned char const * const pend=p+ncolumns;p<pend;++p)
        {
          *p = (*p>threshold) ? 1 : 0;
        }
      }
  grays = 2;
}


Generated by  Doxygen 1.6.0   Back to index