View License

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

» Watch video

Highlights from
Color Threshold

4.6 | 9 ratings Rate this file 34 Downloads (last 30 days) File Size: 40.4 KB File ID: #25682 Version: 1.2
image thumbnail

Color Threshold



29 Oct 2009 (Updated )

Allows users to interactively select/deselect pixels to threshold images using RGB or HSV filters.

| Watch this File

File Information

Quickly setting RGB or HSV values for color thresholding is a common problem in laboratory robotics. ColorThreshold.m allows you to load an image and interactively set either RGB or HSV thresholds. Call the function ColorThreshold('image_name'), select your Region Of Interest, then select and deselect pixels and watch the thresholded image and RGB/HSV scatter plots to fine tune your threshold filter. You can switch between HSV and RGB while the program is running, and can choose to split the Hue threshold (single color objects commonly have a wraparound in the Hue value). The update allows users to interactively tune their filters with slider bars and move the ROI.


This file inspired Buoy Detection Using Simulink.

MATLAB release MATLAB 7.3 (R2006b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
10 Feb 2017 AWANIT KUMAR

15 Jan 2017 XiaoLong LI

Thank you for your wonderful work,very useful!

28 Mar 2016 Mohd Faid Yahya

19 Sep 2015 Zhenqiang YING

Thx,very useful!

15 May 2015 Aasd

Aasd (view profile)

23 Feb 2013 maida

maida (view profile)

will you kindly turn this code to recognize the color of ROI.. or somebody who can do this plz mail me at

18 Feb 2011 Kenz

Kenz (view profile)

Interesting idea, but fails majorly due to leftover non-standard RGB2HSV calculation. The code needs to be fixed to use Matlab's rgb2hsv, and then possibly offer the non-standard one as an interesting case for a faster, less processor-intensive calculation.

01 Oct 2010 Muhammed Talu

Very useful

08 Mar 2010 Tomáš Bílek

Great :)

06 Nov 2009 1.1

The update allows users to interactively tune their filters with slider bars.

30 Nov 2009 1.2

Allow user to move the ROI and error checking

Contact us