# Classification of similar color histograms

**URL:** <https://forum.opencv.org/t/classification-of-similar-color-histograms/17707>\
**Category:** Python\
**Created:** [May 21, 2024, 12:05pm UTC](https://forum.opencv.org/t/classification-of-similar-color-histograms/17707 "2024-05-21T12:05:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MobileRobotics](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mobilerobotics/32/8060_2.png) [@MobileRobotics](https://forum.opencv.org/u/MobileRobotics)\
**Post date:** [May 21, 2024, 12:05pm UTC](https://forum.opencv.org/t/classification-of-similar-color-histograms/17707/1 "2024-05-21T12:05:01Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/0/0584e6bd4cd004f75ce1812fa20c5083977b2ce0.png)

How do I distinguish between colors that have similar histograms as in the example above?  
The picture on the left changes color from top to bottom and the picture on the right changes color from the border to the inside.  
I wonder if I can calculate the pixel-specific difference value.

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [May 21, 2024, 12:47pm UTC](https://forum.opencv.org/t/classification-of-similar-color-histograms/17707/2 "2024-05-21T12:47:27Z")

</div>

You cannot.  
What is it for?

Of course if you have got both original image a difference will do the job

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [May 21, 2024, 12:59pm UTC](https://forum.opencv.org/t/classification-of-similar-color-histograms/17707/3 "2024-05-21T12:59:23Z")

</div>

stretch contrast.

think in luma and chroma.

shrink the picture.

borrow from video compression. DCT should be able to represent the first one’s vertical gradient and the second one’s square-radial gradient.

---

<div class="post-metadata">

**Author:** ![MobileRobotics](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mobilerobotics/32/8060_2.png) [@MobileRobotics](https://forum.opencv.org/u/MobileRobotics)\
**Post date:** [May 22, 2024, 1:55am UTC](https://forum.opencv.org/t/classification-of-similar-color-histograms/17707/4 "2024-05-22T01:55:51Z")

</div>

I didn’t understand what it means to use dct.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 22, 2024, 4:48am UTC](https://forum.opencv.org/t/classification-of-similar-color-histograms/17707/5 "2024-05-22T04:48:57Z")

</div>

> [@MobileRobotics](#):
>
> How do I distinguish between colors that have similar histograms as in the example above?

you could split the image into smaller patches, take histograms of those and concat the partial histos to a larger feature vector (like done in the LBPH face reco)

---

<div class="post-metadata">

**Author:** ![MobileRobotics](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mobilerobotics/32/8060_2.png) [@MobileRobotics](https://forum.opencv.org/u/MobileRobotics)\
**Post date:** [May 30, 2024, 1:24pm UTC](https://forum.opencv.org/t/classification-of-similar-color-histograms/17707/6 "2024-05-30T13:24:18Z")

</div>

Do you have an example code or tell me more easily?
