Re: Bug with B&W conversion
Andrew Stonewall <[email protected]> Mon, 10 Jan 2011 14:34:51 +1000
| Newsgroups | gmane.comp.video.graphicsmagick.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi Bob, I've just spent some time reprocessing some of my sample images with the Local Adaptive Thresholding with different parameters. The results are good in that they expose a lot of extra details but unfortunately they are also increasing the noise level and are not suitable for the project I'm currently doing as they are aesthetically less appealing by a large margin. That said I will definitely be using the LAT method on other projects where OCR is more important as the results of LAT are definitely more OCR-friendly than the dithering/error-diffusion of the Riemersma routine. Given that the Riemersma dither is default, and basically any B&W conversion (explicit or implicit) done by ImageMagick/GraphicsMagick will use this routine, shouldn't this be a priority to get fixed. By my estimates 2% of my images suffer from this bug and are left blank. Regards, Phillip > Date: Sun, 9 Jan 2011 19:24:03 -0600 > From: [email protected] > To: [email protected] > CC: [email protected] > Subject: Re: [GM-bugs] Bug with B&W conversion > > On Mon, 10 Jan 2011, Andrew Stonewall wrote: > > > Hi Bob, > > This bug goes back to the ImageMagick base-code for the 'riemersma' dither routine. I raised this on the > > ImageMagick forums some time back (http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17251) but > > had a hard time convincing their admin that it was a real problem. > > There is definitely a weakness in the algorithm, but it may be > difficult to solve. Color reduction is really intended for full-range > photos. > > > The main reason I'm using ImageMagick (and now GraphicsMagick) is > > that this routine provides an exceptional B&W conversion on some > > very 'noisy' documents that I'm processing at the moment so using > > another dither isn't an option. > > Yes, the quality of the dither can be very nice. Slow but nice. > > Both -ordered-dither and -random-threshold provide recognizable output > from your image but the results are not as nice. > > An alternative is to use local adaptive thresholding (-lat). This > algorithm is good for bringing out the original features of the scan. > The best parameters to use depend on your input image and require some > experimentation. > > Here is an example: > > gm convert original.bmp -colorspace gray -lat 10x10-4% output.bmp > > In this example, it computes the average value of the pixels in a > 10x10 rectangle around the target pixel. Then it thresholds based on > the pixel value being more than 4% different than the average. This > algorithm can use a lot of CPU so it is best to keep the rectangle > size down to the smallest size which reliably works. > > The end result captures all of the written/detail bits, while > eliminating the page background. Perhaps this is what you wanted in > the first place? > > Bob > -- > Bob Friesenhahn > [email protected], http://www.simplesystems.org/users/bfriesen/ > GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Graphicsmagick-bugs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs