Live data from Hacker News

Ditherpunk: The article I wish I had about monochrome image dithering

surma.dev

81–90 of 203 posts

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#81
> However, sRGB is not linear, meaning that (0.5,0.5,0.5) in sRGB is not the color a human sees when you mix 50% of (0,0,0) and (1,1,1). Instead, it’s the color you get when you pump half the power of full white through your Cathod-Ray Tube (CRT).

While true, to avoid confusion, it might be better rephrased without bringing human color perception or even colors into the mix.

sRGB uses non-linear (gamma) values, which are good for 8-bit representation. However, operating on them as normal (linear) numbers using average (expecting blur) or addition, multiplication (expecting addition, multiplication of corresponding light) - gives nonsensical, mathematically and physically inaccurate results, perceived by any sensor, human or animal as not what was expected.

RGB colorspace in it's linear form is actually very good for calculations, it's the gamma that messes things up.

In simplified monochrome sRGB/gamma space, a value v means k·v^g units of light, for some k and gamma g = 2.2. Attempting to calculate an average like below is simply incorrect - you need to degamma¹ (remove the ^g), calculate and then re-gamma (reapply ^g).

  (k*v1^g + k*v2^g)/2 = k*(v1^g + v2^g)/2 != k*((v1+v2)/2)^g
¹ gamma function in sRGB is a bit more complex than f(x) = x^2.2

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#82
I always thought the floyd-steinberg algorithm produced images that looked like they were made from a nest of worms, at least in the implementations I came across in the Amiga era, so it's interesting to look at his FS image and realize that, most likely, it was an artifact of the low resolution display more than anything else.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#85

Earlier quoted context omitted.

That's fascinating -- do you have any links to examples? I'm searching online but can't find anything at all. I've never heard of using Retinex in the context of dithering, and wondering what specifically you mean by Retinex-"like"? I'm also really curious what contexts this has been most successful in. E.g. was it used for dithering in images or games back in the 1990's when we were limited to 16-bit or 256-bit colo…

GIMP has it: Colors > Tone Mapping > Retinex

Ah thanks, just tried it out and it indeed produces quite a different result using that filter (default settings) before dithering.

Here's a side-by-side comparison using an image from the front page of nytimes.com (be sure to click to zoom in for the full effect):

https://imgur.com/a/mrHl7FW

Without it (left), a photo remains "accurate" in terms of brightness levels.

But with it (right), it becomes far more high-contrast to feel closer to an illustration or painting. Which certainly makes it clearer. But while it brings out details in middle levels, it totally blows out shadows and highlights.

E.g. the texture of his mask, shirt, and her hand are much clearer. But on the other hand, their hair (and a background object) just turn solid black and lose all detail. But certainly, the vastly higher contrast makes for a much more compelling image IMO.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#86
If you want to play around with dithering on macOS or iOS, vImage in the Accelerate framework provides most of the algorithms discussed in the article (including Atkinson!), with performance more than adequate for most applications (and with convenient vImage utilities to fit them into a CV pixel buffer pipeline for video work). vImage also supports dithering to other bit depths, though one-bit output is what you want for that vintage look.

https://developer.apple.com/documentation/accelerate/1533024...

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#87

Back when I worked at Marvell Semiconductor (circa 2005), we made laser printer ASICs for HP. We did a lot of dithering in hardware. We had a hardware block that did error diffusion, we had a hardware block that did regular diffusion. We also had a hardware block that did Blue Noise. I was responsible for implementing the firmware that drove those printers' scan/copy path: scan an image in monochrome, run through the…

Now that's amazing. Not only because it was hardware based, but because you were solving a real problem, a limitation, instead of just aesthetic endeavor. It was an engineering solution. There is a lot of aesthetic beauty in mundane engineering, rarely seen by anyone. So kudos to designers to pick out something interesting and giving it the light :) It's all cool.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#88
I think there is a trade-off between spatial resolution and color depth. Dithering reduces the former to simulate increasing the latter.

Perhaps we can get a similar result by interpreting the original signal (after linearization) in a different way. It could represent (after normalization) the probability each pixel would be 1 or 0. That way, brighter areas would have more density of bright pixels, and darker areas would have more density of dark pixels.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#89
post #30
post #5

> According to Wikipedia, “Dither is an intentionally applied form of noise used to randomize quantization error”, and is a technique not only limited to images. It is actually a technique used to this day on audio recordings […] Dithering as a digital signal processing technique is also used frequently in the digital control of physical systems. One example of this is in the control of hydraulic servo valves[1]; the…

I believe this is what the engines are doing during the majority of the ascent of the Starship SN8 test vehicle[0]. You can see the engines gimbaling very slightly in a circular pattern. [0]: https://youtu.be/ap-BkkrRg-o?t=6516

Anything controlled by a PID can easily end up in a circular pattern, so it's not a given that this was to avoid stiction.

[edit]

1 dimensional PIDs can end up in a sinusoidal dynamic equilibrium, and a 2 dimensional sine wave is an ellipse.

Post reply on HN