File Exchange

image thumbnail

Color segmentation by Delta E color difference

version 1.0 (356 KB) by

User draws region and this finds pixels in the image with a similar color, using Delta E.

15 Ratings



View License

Demo to perform very, very simple color detection in LAB color space. The RGB image is converted to LAB color space and then the user draws some freehand-drawn irregularly shaped region to identify a color. The Delta E (the color difference in LAB color space) is then calculated for every pixel in the image between that pixel's color and the average LAB color of the drawn region. The user can then specify a number that says how close to that color would they like to be. The software will then find all pixels within that specified Delta E of the color of the drawn region.

Comments and Ratings (27)

Diah Junaidi

i got an error in 'getWorkArea' while executing 'my own image'....somebody help me please :(

Nathalie Roos

What are the labels of the y and x axis? what does the numbers stand for?

The rest of it is very clear and good, thank you!

Chloe Hind

Thank you for the code. Is there a version in which I could segment colour from a video please?

anggi nego

Muhammad Umar



iza (view profile)

Thank you very much...after 3 days, I manage to solve my problem after looking at this code..although I need to point out row by row, it is helped me a lot. Thank you.

zohaib nawaz

admire your work.
I just wanted to know where can I study in detail this method? Specially the automatic calculating of tolerance method?
Any help in this case would be highly appreciated

Manu BN

Manu BN (view profile)

Fari Nami


Very good and simple software! But how can I extract the segmented data?


Buddy (view profile)

great work bro... Thanks for sharing this code.. Is it possible to do in the HSV colorspace?


Kumar (view profile)

I am a research student. I would like to use your methodology (Color segmentation by Delta E color difference) for shade matching.
I just want to find where the reference shades (from a standard color chart)are located in the chosen image? Is it possible?
Plz help me


Atanas (view profile)

Hello, may I ask how can I segment every color object in separate picture, I mean for example on the next picture to segment only red object (red colored off course), on the next blue object and so on. Thank you in advance for the help :)

uvan siya

Image Analyst >> Please send me the base paper for this "Color segmentation by Delta E color difference" . my mail is

Image Analyst

Image Analyst (view profile)

ajit, if there is a brightness change, there is a color change. If you want to detect a hue, regardless of it's brightness, then you can use my HSV color segmentation demo and just threshold on the hue value. However skin is a boomerang-shaped gamut and can't be gotten by any simple carving up of the gamut in any 3D color space, no matter which one you pick. You'd need to carve out the boomerang shape, not just a hue sector or a delta-E ball shape.

ajit sarode

works very accurate if said to choose any color however if there is brightness change for same color in rest of the picture than selected, then it does not detect(skin color with different brightness),can u please help?

Well commented/explained.

Works quite well. Well commented.
Can you add the reference to the paper or the math/theory behind this work?

Well commented/explained.

Image Analyst

Image Analyst (view profile)

Marium: I don't recall getting anything from you.


Marium Malik

Have messaged you the error

Image Analyst

Image Analyst (view profile)

arman: How did you run it? What was the exact error message? I just downloaded it and ran it, and it was fine. Click my name above and then click the "Contact Author" link to send me this information.

arman Yaraee

It doesn't work. Whenever I draw a region it gives error of too many output arguments!!

Image Analyst

Image Analyst (view profile)

You can use it for indexed images if you convert the indexed image into an RGB image with ind2rgb().


dion (view profile)

can i use it for index image???

MATLAB Release
MATLAB 7.12 (R2011a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today