Steve on Image Processing

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.

color-thresholder-initial

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.

apps-tab

ipcv-apps

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.

color-thresholder-green

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.

color-thresholder-red-orange

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

color-thresholder-orange

color-thresholder-red-a

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

color-thresholder-desk

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

color-thresholder-opacity

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

color-thresholder-export-function

color-thresholder-generated-code

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.

7 CommentsOldest to Newest

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.

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

Hello,
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.

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.

These postings are the author's and don't necessarily represent the opinions of MathWorks.