Sunday, November 5, 2017

monochrome (1-bit black-and-white) image conversion


When converting scanned text to a 1-bit black-and-white image what are some filters that one can apply in the process to improve the result? Right now I am running into the problem where dithering errors make the image look horrible.


Update: I think trying to undo dithering is a much harder problem. How can I convert the first image to a monochrome image? The default approach convert -monochrome img1 img2 is shown below. I've also tried a two-step approach: 1) decrease depth (color palette) and gamma 2) convert to a bilevel image (not shown). Other things I played with included imagemagick's ordered-dither (at various settings), but it wasn't as good as the two-step approach.


text image monochrome image




Answer



I would suggest for this case that you upsample and apply a slight blur and then a sharpen, then apply the threshold operation. You won't get any more information from the pixel data, it's simply not there. But you'll get a smoother result out of the thresholding operation, and you won't need to dither. The end result is like a photocopier degradation.


Example:


result


Also, this is what it looks like when you just use a better diffusion dither algorithm ;)


enter image description here


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...