I have an image A which I have divided into 4 x 4 subband images. For a given patch P1 in image A, I need to find another patch P2 in the same image A which is most similar: have same texture.

Till now my appraoch is to create feature vectors Fi for all i patches and using Euclid's distance formula find out which patch's feature vector is closest to given patch P1's feature vector.

Currently I have added following features:

  1. Mean & Standard Deviation of brightness (using L channel of LAB colorspace)
  2. Mean & Standard Deviation of color values in A channel of LAB colorspace
  3. Mean & Standard Deviation of color values in B channel of LAB colorspace

Although I am getting similar patches but I still think the matching can be improved if I incorporate more prominent features (which I'm unaware of).

Following are my queries:

  1. I have a doubt whether this is a good way to compare color between two patches.

  2. Please suggest some more good features which can be helpful to get a proper differentiation.

  3. Although most of my images are proper but are there any restrictions/drawbacks with the approach if image is dark and/or noisy? If yes, is there a good alternative approach or feature(s)?

Please help!

  • $\begingroup$ Interesting question! Can you perhaps add an example of what the "unexpected" match is? What match are you getting? $\endgroup$
    – Peter K.
    Sep 8, 2015 at 13:15
  • $\begingroup$ Unfortunately, I cannot upload any images due to some restrictions where I am working. But, the problem is the closest patch which I am getting is not correct. Even for 'red' colored textured patch, the patch getting matched is one which contains light background colors. $\endgroup$
    – kunal18
    Sep 8, 2015 at 13:36
  • $\begingroup$ @stalin you can always find a similar or simulated image which is closer to your original image. If you don't have one then create one & post it! It will be useful! $\endgroup$
    – Balaji R
    Sep 9, 2015 at 5:45
  • $\begingroup$ How big are your feature vectors? Have you tried normalising them? $\endgroup$ Sep 9, 2015 at 7:37
  • $\begingroup$ Currently, I have only 3 features in each of the feature vector: std of brightness, std of color values in A channel and std of color values in B channel $\endgroup$
    – kunal18
    Sep 9, 2015 at 7:39

2 Answers 2


The mean and standard deviation are two measurements of a distribution. Others you could also use are higher order moments like 'skewness' (how skewed the distribution is) and 'kurtosis' (how 'peaky' the distribution is).

However, what I would try is a histogram of the values for each of the channels. For example, if you used a histogram with 16 bins, you would get a feature vector with 48 values. The histogram bin values can be thought of as a descriptor of the distribution.

To account for changes in brightness, you need to introduce some illumination invariance. Already the LAB colour-space splits the image into luminance (L) and color (AB) channels. To achieve illumination invariance I would normalise the L channel histogram values using the norm of whatever measure you are using (in this case, euclidean distance, it would be the l2 norm). Normalising the A or B channels is probably not necessary. The normalisation accounts for any linear changes in luminance.

Depending on the images, you could also add vectors like:

  • histogram of oriented gradients (HOG)
  • histogram of connected components (make B/W then count how many pixels are white in the 8 connected neighbours)
  • k-means clustering of LAB values to get k centre LAB values which you can compare to other images.

and so on.

  • $\begingroup$ So, in my feature vector Fi for each patch i, I should have histogram for each color channel? And while comparing two patches, I must calculate distance between respective histograms using some distance like Chi-square? $\endgroup$
    – kunal18
    Sep 10, 2015 at 7:05
  • $\begingroup$ Yes, but you could just use euclidean distance $\endgroup$ Sep 10, 2015 at 8:04
  • 1
    $\begingroup$ Imagine you have a vector $\mathbf{a}$ and another vector that is a scaled version of $\mathbf{a}$, $\mathbf{b} = \lambda\mathbf{a}$. If you compared the two vectors with euclidian distance you would get some non-zero result. But what if you wanted to compare the two vectors without regard to their magnitude? To do this you would normalise them. en.wikipedia.org/wiki/Norm_(mathematics) The type of norm you use depends on the distance measure you are using. e.g. you dont normalise with the l1 norm (manhattan distance) if using an l2 distance measure (euclidean distance) $\endgroup$ Sep 10, 2015 at 9:51
  • 1
    $\begingroup$ Illumination is typically a linear increase in brightness. e.g. for an image $a(x,y)$, a brighter image might be $b(x,y) = \lambda a(x,y)$. So if you wanted to introduce illumination invariance for some measurement $\mathcal{O}$, then you must have $\mathcal{O}(a) = \mathcal{O}(b)$. $\endgroup$ Sep 10, 2015 at 9:54
  • 1
    $\begingroup$ With you images, just looking at the patches what features does your brain identify as being important to differentiate them? (The human brain is the worlds best image analysis system) $\endgroup$ Sep 11, 2015 at 0:51

Regarding LAB, it is a good way if you are interested in the differences as humans perceive them.

About texture, I would suggest taking a look at some proprietary texture descriptors:

  1. Gray level co-occurrence matrix.
  2. Response to wavelets

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.