1
$\begingroup$

I want to measure the similarity between quantized grayscale images (8 levels) that mostly depict organic patterns found in nature, say pigmentation patterns in animals (zebra pattern, leopard spots,..). I cannot use some kind of trained model, and I need a continuous similarity value. Feature scale tolerance is not important, but differences in rotation and density of the features could be large. Ideally two different flat textures of zebra patterns should have a similarity of 1.0 and say zebra-tiger a similarity of 0.7. I understand how impossible that sounds, but I hope someone could point me to relevant current research or methods somewhat suitable to what I'm looking for.

EDIT: More info about the desired usage.

Examples of images undergone grayscale conversion and quantization: (512x512 pixels, 8 gray levels). I do not own these images.

These are then used as templates for a procedural pattern generation technique I am developing. Images are randomly generated, generation settings that produce high similarity are kept to be further tweaked. The procedurally generated images could be anything from random pixels to intricate shapes, slowly converging at the image of highest possible similarity.

$\endgroup$
  • 1
    $\begingroup$ Just to check if I am getting this right, you want to be able to tell that two patterns that could be coming from two entirely different zebras are "identical" because they are examples of very similar settings of some model that generated them, but zebra-to-leopard are not because the parameters of the model that would have generated them are vastly different. Correct? (Can you post an illustrative set of images?) $\endgroup$ – A_A Jul 25 '16 at 11:02
  • $\begingroup$ I second the request for illustrative images; 3-bit-quantization makes this all the harder to imagine. $\endgroup$ – Marcus Müller Jul 25 '16 at 13:49
  • $\begingroup$ A_A you 're reading my mind man, but thats for a next chapter. I'm currently trying to generate specific settings for my model to produce those shapes. Marcus Müller I have included some images from the net undergone the quantization process. As you can see there's hardly any visual difference from the original greyscale, but makes a huge difference when evaluating similarity (at least with the techniques I've used). $\endgroup$ – potis Jul 25 '16 at 15:43
0
$\begingroup$

A classification of the repertoire of the patterns that can be exhibited by reaction diffusion models has been attempted and this map might already be close to what you are after.

Other than this, if you absolutely have to create a metric of similarity that emerges from the images themselves then my suggestion would be to look at some form of invariant or universal feature.

You could for example look at Mutual Information between the two images and more specifically, LZ Complexity (which is not reciprocal, so $f(x,y) \neq f(y,x)$ where $f$ is the metric). The difference here is that mutual information essentially characterises the differences between the distributions that give rise to signals (therefore, the processes where they came from).

Also, looking at the sort of "shapes" the model creates, it seems to swing between relatively broad line strokes and point / circle structures. So, you could apply a simple threshold to the resulting image and then run a Hough Transform on it and try to estimate a ratio of "line-icity" (i.e. amount of sharp tall points in the image) to "circleicity" (double pairs of points at a specific configuration). I am not sure how sensitive or accurate would that be for a small change in the model's parameters though.

Hope this helps.

$\endgroup$
  • $\begingroup$ Wow, I'll need a couple of days to process the information. Really great answer, thank you for taking the time! $\endgroup$ – potis Jul 27 '16 at 15:18
  • $\begingroup$ No worries, glad you found it helpful. $\endgroup$ – A_A Jul 28 '16 at 8:25
0
$\begingroup$

This question is very broad, yet interesting. Your way to go are co-occurence matrices.

Co-occurence matrices can be calculated for each image and provide further indicators which specifically allow identification of different textures.

Note that there does not exist a single co-occurence matrix for an image, but several ones, since the co-occurence matrix is defined for specific directions of occurence. Further, you can vary the granularity of the co-occurence matrix. For each co-occurence matrix you can derive several features which enable you to distinguish the textures.

This example is very simple, yet should enable you to understand:

Image you have black-white picture of only a single line of pixels such as:

[0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0]

Now there are there are four possible co-occurences of pixel neighbours:

1) [0,0]
2) [0,1]
3) [1,0]
4) [1,1]

For each these we will now count the times that you can them within the strings:

1) [0,0] ---> 4
2) [0,1] ---> 3
3) [1,0] ---> 3
4) [1,1] ---> 0 

This will give us our co-occurence matrix:

[[4,3],[3,0]] which is specific for each pattern. 

Based on this co-occurence matrix, you are able to calculate features, such as Contrast, Correlation, Energy, Homogenity and many more.

Matlab provides you with tools to get the co-occurence matrix. Further, wikipedia provides an introduction.

Once you implemented this and encountered your first problems, I am looking forward to your next question. Good luck.

$\endgroup$
  • $\begingroup$ Thank you for the detailed answer! I am familiar with cooccurence matrices, in fact that was the first method I used to measure similarity: The inverse of the sum of absolute differences between the constrast, energy and homogeneity of the images. I used an offset of 8 for 512x512 images. I've found that the results were great for full 255 range grayscale images with a lot of things going on. In my case though, with only 8 levels, and high contrast patterns, the results were seemingly random. Do you have any pointers? Maybe my implementation / settings are incorrect. $\endgroup$ – potis Jul 26 '16 at 14:14
  • $\begingroup$ you will have to provide your implementation. Further: did you combine contrast, energy and homgeneity to one indicator? if so, this would mean grave loss of information. You should rather preserve them as a feature vector for classification. Also....although mostly only these 4 features are calculated, there are originally 16 features of the co-occurence matrix to be calculated. $\endgroup$ – Nikolas Rieble Jul 26 '16 at 14:17
  • $\begingroup$ I don't want to waste your time digging through my code, so I will move into Matlab as you suggested. There are definetely things I don't completely understand or haven't tested. Unfortunately this cannot be reduced to a classification problem, as the user may provide any pattern image to the generator, so I either have to combine the COM statistics or do some more elaborate comparison. Although, for testing purposes I will try classifying some patterns first and I will definetelly get back to you with the results. $\endgroup$ – potis Jul 26 '16 at 14:33
  • $\begingroup$ Great! It is great question with a lot of potential applications (e.g. robotics, machine-vision). Good luck. $\endgroup$ – Nikolas Rieble Jul 26 '16 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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