The Well-Tempered Palette (Part 2)

July 17, 2018

Last week, we’ve had a look at how to distribute maximally different colors on the RGB cube. But I also remarked that we could use some other color space, say HSV. How do we distribute colors uniformly in HSV space?

Read the rest of this entry »


The Well-Tempered Palette

July 10, 2018

When we use false color to encode useful information in an image, it helps greatly if the colors are meaningful in themselves (like a rainbow to encode heat) or maximally different when the image is segmented (like a map showing geologic provinces). But how do we chose those maximally different colors?

Somehow, we need a maximally distributed set of points in RGB space (but not necessarily RGB). We might have just what we need for this! We’ve discussed Halton sequences before. They’re a simple way of progressively and uniformly distribute points over an interval. The sequence starts by the ends of the interval then progressively fills the gaps. It generates the sequence 0, 1, 0.5, 0.25, 0.75, 0.125, 0.625, 0.375, 0.875, …

Read the rest of this entry »


HSV and HSL (colorpsaces XI)

July 3, 2018

HSV (hue, saturation, value) and HSL (hue, saturation, lightness) are two intuitive, but computationally cumbersome, colorspaces.

The basic idea behind these colorspaces is the good ol’ color wheel, where primary colors are placed on a triangle and secondary colors between; complementary colors are to be found opposite on the circle. That’s intuitive enough, but we still have to make it into a workable colorspace.

Read the rest of this entry »


Linear Feedback Shift Registers (Generating Random Sequences XII)

June 26, 2018

While working on a project with a student, I had a look at linear feedback shift registers as a mean of generating (pseudo)random values. The principle isn’t very complicated: you select a number of bits in the register and use them to compute one bit value, you shift the register by one position and insert the new bit in the vacant spot.

Typically, the function is merely a series of exclusive ors, which basically computes the parity of the selected bits. This will help us create an efficient implementation—maybe using the compiler intrinsics.

Read the rest of this entry »


Pantone Colors (Colorspaces X)

June 19, 2018

Let’s have a look at another physical colorspace: Pantone.

The Pantone color system isn’t particularly useful for us as it is mainly concerned with “real world” colors, as in print. It also uses a variety of special dies, for metallic or fluorescent finish. It does, however, allow very accurate and consistent color reproduction for packaging, posters, and comics.

Read the rest of this entry »


Munsell Colorspace (Colorspaces IX)

June 12, 2018

While the RGB and its transformed colorspaces are useful for computer graphics and video compression, there are other colorspaces that deal with “real life” materials, like ink and paint. Albert Henry Munsell (1858–1918), a painter, proposed such a system.

Unlike RGB and its friends, the Munsell colorspace isn’t based on mixing three primaries, but rather on hue (tint), value (brightness) and chroma (density of color, or saturation), and colors are arranged on a color wheel, but unlike the usual three/six primary color wheel, Munsell’s has 5 primary colors [1].

Read the rest of this entry »


Easy numbers

June 5, 2018

Some numbers are easier to work with than others, especially for computer arithmetic—and even more so with weak processors. So let’s have a look at easy numbers that we can sometimes exploit to get faster code.

Read the rest of this entry »