I'm trying to use the concept of lacunarity to classify images, as per how a few research papers have done it. To verify whether my equations and implementation are correct, I'm trying to verify the output of my program - for images with same fractal dimension, lacunarity is inversely proportional to the denseness of an image - denser the image, lower is its lacunarity.

For example, if I plot two triangular Koch curves, one with order 4 and another with order 6(order meaning iterations), both would have the same fractal dimension. Then you would expect the image with order 4 to have comparatively higher lacunarity since its less dense.

Now, after computing the lacunarity, there are two possible plots you can get - non-normalized and normalized lacunarity. When I plot the non-normalized lacunarity, I get the correct output - the order 4 curve has higher lacunarity. Whereas when I plot the normalized lacunarity, the plots exchange their positions and the order 6 curve ends up having higher lacunarity which seems incorrect.

The research papers that I'm referring are only using normalized lacunarity in their applications. I'm not sure where am I making an error.

Lacunarity is defined as follows -
For a m x n binary image, you define box size r, where r ranges from, for example, from 1 to 100.
Lacunarity is defined for every r. For a given r, it is computed as the ratio of (A+B)/B
Where A = Variance of X
B = Square of the mean of X

Where X = no. of 1s within a box of size r x r. So you compute mean and variance over all possible boxes of size r x r in the m x n matrix. Then r is varied from 1 to 100 for example, and hence lacunarity value is computed for 100 values of r, after which you can plot lacunarity.

Normalized lacunarity is obtained by dividing Lacunarity[r] by Lacunarity[1] for all r.

So I need help with 2 questions:
[1] Am I making an error in the concept of lacunarity being inversely proportional to denseness, or is it that I'm making some mistake while plotting normalized lacunarity itself?

[2] Is there a way I can verify that I am implementing lacunarity calculation correctly? For example, if there are standard images whose lacunarity plots are well known. I can plot lacunarity for those standard images and verify that I am getting a similar lacunarity plot.


2 Answers 2


I think this is a conceptual issue. Your images are not fractals, they are approximations to fractals. Lacunarity is a property of the fractal curve, not of its approximation. The Koch curve has a specific lacunarity.

Your program computes a measure that is inspired by lacunarity, from a given approximation to a fractal. This measure determines what fraction of the image can be considered a hole at a given scale.

Your normalized lacunarity I hadn’t seen before. But it normalizes the curve by the value at r=1, the smallest possible scale in the image. Obviously at this scale the difference between your two images is the largest, since at a larger scale they should be identical (the difference is in the fine details). By normalizing by this value, it is expected that the ratio elsewhere, where the differences are smaller, will reverse.


You asked "Am I making a conceptual error" and "Am I making an implementation error".

For these you must go back to "canon", to the original sources.

Here are several, decently authoritative, sources:

What I particularly like about the MIT link is that it has a rich bibliography with articles from Mandelbrot himself in Physical Review. It is harder to get more authoritative than that.

Often they provide worked examples, which you can compare your answer to theirs.

One of your challenges is "images". In a high spatial resolution universe, your "level 4" vs "level 6" is correct. If you have few enough pixels, that becomes questionable. Pixels are uniformly distributed, but points on the fractal are often not. At some point every fractal is going to exceed the resolving power of the bitmap, or even of double-precision number representation.

As someone with some experience in Image processing for quality inspection, I would give you several hints for success.

  1. There are no "silver bullets", no "philosophers stone" that makes gold from lead and gives immortality. We get tools in our toolbox, so the goal is to have a balanced toolbox of medium size where you have solid experience with all the tools, and you have a good diversity of tools. This is true with image classification. You are going to get a single number out for lacunarity, (real) perimeter, (real) area, (real) height or width, and other summary statistics. I like directionally projected bin-structures, as if all the bits from a window of space fell in a pile along the floor, ceiling, wall, or a random line in the space. Having a good enough set of those is going to get you where you want to go about 98% of the time. Being solid with those will bring home 98% of the results you want.
  2. Two of my favorite inventions are the staple and the paperclip. They are profoundly simple, yet in the transformation a piece of wire gains a 20x increase in real value. Simple is powerful. The real world is surprising and noisy; it is messy. Attacking a problem first with simple tools has surprised me with good and solidly less costly results. Be more curious about simple but effective over complex and unknown. You should balance your investment in the two classes of tools using a Taleb Nassim style of anti-fragile investment strategy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.