Saturday, May 26th, 2018

A recent question on Stack Overflow really stroke my curiosity. The question was about why MATLAB’s `rgb2ind` function is so much faster at finding a color table than k-means clustering. It turns out that the algorithm in `rgb2ind`, which they call “Minimum Variance Quantization”, is not documented anywhere. A different page in the MATLAB documentation does give away a little bit about this algorithm: it shows a partitioning of the RGB cube with what looks like a k-d tree.

So I ended up thinking quite a bit about how a k-d tree, minimizing variance, and color quantization could intersect. I ended up devising an algorithm that works quite well. It is implemented in DIPlib 3.0 as `dip::MinimumVariancePartitioning` (source code). I’d like to describe the algorithm here in a bit of detail.

(more…)

Tags: clustering, color, DIPlib, k-d tree, k-means, minimum variance, quantization, threshold.

Posted in algorithms, tutorials | No Comments »

Sunday, June 23rd, 2013

We recently organized the 11^{th} International Symposium on Mathematical Morphology here in Uppsala. I’m very happy with how the event turned out, and we got lots of positive comments from participants, so all our hard work paid off. We had a nice turnout, very interesting presentations, and lots of discussions. And I’m now the editor of a book containing all the papers presented.

There seem to be several trending topics in the ISMM community at the moment. One of those is the application of Mathematical Morphology to colour images. People have been working on this topic for a while now, and still there is no optimal solution. This year, three very different methods were presented to try and solve this problem. But what is this problem about?

(more…)

Tags: color, filtering, mathematical morphology, vector ordering.

Posted in tutorials | 2 Comments »

Tuesday, August 25th, 2009

There are a few things in DIPimage that I’m annoyed with but can’t solve. Some of these are caused by the limitations of the MATLAB interpreter, and some are caused by my own poor design choices. DIPimage evolved over time to do things that I hadn’t at first even thought about, such as processing color images. Tensor and color images were “tagged on”, if you will, on top of the `dip_image` object, introducing some oddities and inconsistencies. To fix these up we would need to change existing behavior, which we don’t want to do because it would break too much existing code. This blog entry is about the few weird things with the `dip_image` object and how to work around them.

(more…)

Tags: color, concatenating, design choices, dip_image object, dip_image_array object, DIPimage, end operator, evolution, imarsize, imsize, indexing, iterate, size method, tensor image.

Posted in tutorials | No Comments »

Tuesday, March 31st, 2009

While commenting to a recent blog post by Loren, someone linked to this article at IBM Research. I thought it had some very interesting points, and made me think about the `'zerobased'`

colour map in DIPimage. It is designed to highlight positive versus negative values, for example when displaying the difference between two images. Using a simple grey value colour map it is difficult to determine what exactly is the zero level.

(more…)

Tags: color, color map, DIPimage.

Posted in visualization | 5 Comments »