4
$\begingroup$

I want to describe the color of an image patch (say, of size 5x5) centered around a pixel of an RGB image. The most straightforward way to do that is to calculate the average color over that patch and have a 3D vector, where each component represents the average color of the corresponding channel.

Another way, more informative in my opinion, is to calculate an weighted average where the weights decrease the further we go from the center of the patch. In the literature, is there an efficient and proven way to describe the color of a small patch of an image?


I'm asking this question because I'm trying to implement a particle filter that tracks an object that has a certain color. Now, the object I want to track is very narrow, so my patch should be very small to fit inside it.

Most of the color-based particle filtering algorithms represent the color information with a histogram and calculate the battacharyya distance - for example, between the histogram of the particle and the reference histogram. For a patch of 5x5, a histogram is not efficient because there are only 25 pixels.

On the other hand, patch descriptors like SIFT and SURF are not suited for color in my opinion (but if you have a different opinion it's more than welcome), this is why I'm looking for another way to robustly represent the color on a small patch of pixels.

$\endgroup$
1
  • $\begingroup$ Both methods you're describing are really nothing more than a low pass filter kernel applied to an image. So, both of these approaches are just "smoothers". The first one has a "flat square" kernel, whereas your weighting might just be any kernel. I think the key to an answer here is that, since you already have an opinion on what is more helpful to you, start describing what your application is, and what your images are. That way, you can actually find something that helps you rather than just a long list of halfway related things. $\endgroup$ Commented Dec 14, 2017 at 19:50

1 Answer 1

1
$\begingroup$

Another approach which might be appropriate in your Bayesian approach (Filter Particle) would be Mean Vector + Covariance Matrix.

Even for that you could employ your idea of weighing (Which is reasonable).

I would pay attention to the color space you're working in.
Euclidean Distance isn't working (At least not well) in RGB.

Example in CIE LAB

The mean is given by:

$$ {x}_{c} = \frac{1}{n} \sum_{i = 1}^{n} {p}_{i} $$

Where $ {p}_{i} \in \mathbb{R}^{3} $ is the vector of LAB valus of each pixel from a patch of $ n $ pixels.

The Covariance is given by:

$$ {C} = \frac{1}{n} \sum_{i = 1}^{n} {\left( {p}_{i} - {x}_{c} \right)} {\left( {p}_{i} - {x}_{c} \right)}^{T} $$

$\endgroup$
3
  • $\begingroup$ Actually I'm doing the calculations in CIE Lab, and am using the euclidean distance as a matric. Could you please expand your answer as of how to use the mean vector + covariance matrix? $\endgroup$
    – S.E.K.
    Commented Dec 15, 2017 at 7:58
  • $\begingroup$ I added the case of CIE LAB. Well, it works like any other euclidean space. So nothing new about the equations. Please mark the question. $\endgroup$
    – Royi
    Commented Dec 6, 2019 at 4:51
  • $\begingroup$ @S.E.K. Could you please mark my answer or describe what is missing? $\endgroup$
    – Royi
    Commented Sep 22, 2022 at 15:20

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.