Texture Comparison with OpenCV and Gabor Filters

As part of the project, I'm trying to measure how similar the 2 textures taken from the image are. (I take 2 square samples about 40 x 40 pixels).

After I take the samples, I transfer them to the Gabor filter bank (with two filter sizes and 6 orientations), so now I have 12 output filters for each sample.

The goal is to calculate a metric that tells us how similar 2 textures are , so that if 2 samples are wood or brick, a metric estimate (the difference is small), but if 1 sample is stone and the other is fabric, the metric should be high (the textures are very different).

Question: How to measure the difference in texture using these outputs? I was asked to create a distribution of the outputs for each sample, and then measure the distance between the two distributions, but I just do not know how to do this.

Filters look something like this: (not entirely accurate):

Filter bank

The result looks something like this (I used this image as an example)

enter image description here

+4
source share
2 answers

The main approach for texture coding is to calculate the histogram filter responses from the window. Then you compare the textures using the histograms. A good way to get started is to look at the Local Binary Patterns .

A simplified explanation of the LBP histogram: each pixel of the input image is described by its 3x3 neighborhood. The area is converted to an index [0.255] on the threshold. The index then identifies the bit in the histogram.

+3
source

I know this is an old thread, but this page can help future visitors: http://scikit-image.org/docs/dev/auto_examples/plot_gabor.html

This is an example in Python that uses the mean and variance of a filtered image as discriminatory features (see the compute_feats function). The metric for comparison is the least square error (see the match function).

+2
source

All Articles