Live data from Hacker News

Image Dithering: Eleven Algorithms and Source Code

tannerhelland.com

31–40 of 65 posts

Re: Image Dithering: Eleven Algorithms and Source Code

#31

Great and easy to follow article! > For simplicity of computation, all standard dithering formulas push the error forward, never backward. If you loop through an image one pixel at a time, starting at the top-left and moving right, you never want to push errors backward (e.g. left and/or up). Would the image look a lot different if you dithered it backwards from the bottom right pixel? Are there dithering algorithms…

Answering my own question; "3.3. Changing image parsing direction": http://caca.zoy.org/study/part3.html

The answer seems to be that changing the image parsing direction gets rid of some artifacts but introduces others while not vastly improving on faster and simpler approaches.

Re: Image Dithering: Eleven Algorithms and Source Code

#32
For an interesting case of modern artistic use of dithering, see the discussion related to development of indie game "Return of the Obra Dinn" [1] (by Lucas Pope, author of "Papers, please"), where a participant contributed a dithering scheme he invented [2] for a specific purpose of making faces of in-game characters better looking and easier to recognize.

[1] https://forums.tigsource.com/index.php?topic=40832.msg121719...

[2] https://forums.tigsource.com/index.php?topic=40832.msg121280...

(Just in case and for easier browsing, I took liberty of uploading a copy to github: https://github.com/akavel/WernessDithering, although I'm not clear on what's the license of the code, unfortunately; that said I hope the numbers in the matrix are not patented.)

(edit: lol, didn't notice there's another thread on Obra Dinn already on HN, now I'm surprised! :)

Re: Image Dithering: Eleven Algorithms and Source Code

#33
post #11

Earlier quoted context omitted.

How can an virtual object (a photo of a woman seen on a monitor) be objectified? The model meant that photo to be used as an object (looked at). If she wanted people to understand her personality more, she would have just written a book.

These are the kinds of things, specifically, that gross me out about this story: (from http://geekfeminism.wikia.com/wiki/Sexualized_environment ) * In geek contexts, they are usually a way for heterosexual men to bond over their common attraction to women. This is othering for anyone who is not a heterosexual man, including, obviously, women, and contributes to their invisibility in the field. This sensation of excl…

Bear in mind that computer vision has used a cropped image of Lena Söderberg (i.e. the infamous Lena image) for decades now. If you believe the anecdote, the image was not chosen as an in-joke or as a way of sexualising women. The researchers needed a high quality image of a human face (hence they cropped out her body) and they were tired of stock images. Someone in the lab had a playboy magazine and history was made. Most people have no idea that the full version of the image even exists.

The image is so famous that Lena herself was invited as a guest to ICIP 2015 and chaired the best paper award. I think she also gave a talk. I dare say she doesn't have a problem with it.

Re: Image Dithering: Eleven Algorithms and Source Code

#34
Has anyone tried using the equivalent of animated GIFs to help with dithering? If you have a limited palette of colours, perhaps you could produce two dithered versions, with pixels sometimes having different colours in alternate frames. If the image is refreshed fast enough, two colours could blend into a third.

The most extreme example could be 'dithering' a grey square into 1) a black square and 2) a white square, and when they are rapidly switching between the two it might appear as a grey instead.

I guess that in practice, the refresh rates of monitors are too low to make it seem anything other than a terrible flickering image, but on old CRTs the effect might work a little better. It's also memory and CPU intensive, but I'd still be curious to see if it could be used successfully, and if it improved the quality compared to 'just' a single dithered image.

Re: Image Dithering: Eleven Algorithms and Source Code

#35
The article doesn't mention the void and cluster[0][1] ordered dithering (and modernized variants) which have the advantage of ordered dithering that they are highly parallelization, e.g. via GPU shaders but do not leave the easily spottable patterns of ordered dithering.

For example the madVR[2] video renderer uses it for realtime video dithering to avoid banding shallow color gradients from 10bit sources or debanded internal 16bit representation on [0] http://cv.ulichney.com/papers/1993-void-cluster.pdf [1] http://www.hpl.hp.com/research/isl/halftoning/publications/1... [2] http://madvr.com/

Re: Image Dithering: Eleven Algorithms and Source Code

#36

Has anyone tried using the equivalent of animated GIFs to help with dithering? If you have a limited palette of colours, perhaps you could produce two dithered versions, with pixels sometimes having different colours in alternate frames. If the image is refreshed fast enough, two colours could blend into a third. The most extreme example could be 'dithering' a grey square into 1) a black square and 2) a white square,…

The idea is not new, but the gif renderers in browsers have a minimum frame rate, they turn 0-delay frames something larger.[0]

So that doesn't really work for looped animations.

But for single pass you can incrementally build a higher-color image, similar to interlaced loading.[1]

[0] http://nullsleep.tumblr.com/post/16524517190/animated-gif-mi... [1] https://en.wikipedia.org/wiki/GIF#True_color

Re: Image Dithering: Eleven Algorithms and Source Code

#37

Great and easy to follow article! > For simplicity of computation, all standard dithering formulas push the error forward, never backward. If you loop through an image one pixel at a time, starting at the top-left and moving right, you never want to push errors backward (e.g. left and/or up). Would the image look a lot different if you dithered it backwards from the bottom right pixel? Are there dithering algorithms…

>Would the image look a lot different if you dithered it backwards from the bottom right pixel?

Isn't this equivalent to just rotating the image 180 degrees, dithering it, and rotating it back?

Re: Image Dithering: Eleven Algorithms and Source Code

#38
post #36

Has anyone tried using the equivalent of animated GIFs to help with dithering? If you have a limited palette of colours, perhaps you could produce two dithered versions, with pixels sometimes having different colours in alternate frames. If the image is refreshed fast enough, two colours could blend into a third. The most extreme example could be 'dithering' a grey square into 1) a black square and 2) a white square,…

The idea is not new, but the gif renderers in browsers have a minimum frame rate, they turn 0-delay frames something larger.[0] So that doesn't really work for looped animations. But for single pass you can incrementally build a higher-color image, similar to interlaced loading.[1] [0] http://nullsleep.tumblr.com/post/16524517190/animated-gif-mi... [1] https://en.wikipedia.org/wiki/GIF#True_color

That first link is interesting, thanks.

Re: Image Dithering: Eleven Algorithms and Source Code

#39
I still use dithering daily with 24 bit color images. In fact, my test for whether a modern image editor is serious and good is whether it supports dithering when converting from floating point color channels down to 8 bits per channel. Photoshop does this.

The most important reason for me is not display on the monitor, but printing the image. I do a lot of large format printing, and printers smash parts of your color space and make some gradient/banding problems stick out like a sore thumb. Dithering is critical when printing!

Gradients with banding can easily show up when you resize a large image down to a smaller size. This is a good reason that resizing probably anything less than 16 bits per channel images should be done in a higher precision format than the image.

I haven't tried to use an error diffusion dither when converting 16 bits per channel down to 8... I'm not sure how much that matters. It might make a difference, and it sounds fun to code either way, but in my experience, a good random number generator suffices to make color bands vanish.

Post reply on HN