Steve on Image Processing

Concepts, algorithms & MATLAB

Color Thresholder App in R2014a 7

Posted by Steve Eddins,

I had way too much fun this morning playing with the new Color Thresholder app (new in R2014a) in the Image Processing Toolbox, so I wanted to show it to you.


I've shown that picture of M&Ms in this blog before. A few years ago I used that image in a post about color segmentation in a*-b* space. Here's the original image:

You can find the Color Thresholder app by clicking on the APPS tab.



I found the Color Thresholder to be a fun way to explore the a* coordinate (green to red/magenta) and the b* coordinate (blue to yellow) in the L*a*b* color space. Some of the M&Ms have colors that can be segmented completely just using one of the color coordinates. Below I have segmented the green ones just by selecting one of the peaks in the a* coordinate.


But sometimes it is necessary to use both the a* and b* coordinates. The screen shot below demonstrates that one of the a* peaks corresponds to two different candy colors, orange and red.


To get either orange or red, you have to narrow down the range in the b* coordinate.



It turns out the color of my desk is different from all of the candy colors.


You can use the opacity slider to let some of the rest of the image show through.


If you want to automate the segmentation process, the Color Thresholder app can help you get started by generating some code for you.



This post has been kind of hard to write! There was a lot of fooling around with screen captures, and it's hard to do the app justice in this format. I just might have to learn how to do blog videos like Doug does.

If you have ideas for other interactive image processing apps you'd like to see, post a comment here and I'll make sure the team sees it.


Comments are closed.

7 CommentsOldest to Newest

Andrew Scott replied on : 1 of 7

I’m not sure if it would work as an app, but for medical image processing we’d like a full set of interactive tools for drawing and editing regions of interest. The best I’ve come across allow you to draw the region of interest freehand and drag or (even better) nudge the boundary with a circular tool. For an example see Osirix.

keesh replied on : 2 of 7

I have twenty years of real world image processing experience, but still learn something new from Steve’s blog. Long may it run.

rached replied on : 5 of 7

It is a great article and a great app.
I am working on an automatic selection of thresholds to subtract Background from a video according to histograms: Please can you tell me how to choose those values (2 values) ?
I can tell more details if you don’t understand my question.
Thank you very much.

Steve Eddins replied on : 6 of 7

Rached—Try the function graythresh or multithresh, both in the Image Processing Toolbox.

Tirouche replied on : 7 of 7

Je suis étudiante en Imagerie Médical, je prépare mon mémoire de fin d’étude qui a pour titre ‘ Analyse des mouvements de la paroi myocardique du VG dans les séquences cardiaques’ ,et pour cela j’avais besoin de faire un recalage sur les deux images l’une en systole et l’autre en diastole, malheureusement j’ai pas pu trouver des résultats satisfaites … Alors s’il vous plais j’ai besoin de votre aide sur le recalage des deux images en Matlab.

Merci d’avance.