File Exchange

image thumbnail


version (158 KB) by Brett Shoelson
Simple utility to view all color planes, grayscale, and colorspace conversions of an RGB image.


Updated 01 Sep 2016

View License

Takes as an input an RGB image (or the name/path of an RGB image) and creates a figure in which you can see side-by-side the original, the grayscale (RGB2GRAY), and the individual R,G, and B color planes.
Advanced mode also displays some colorspace conversions (HSV, YCbCr, L*a*b*) of the image.
Click on any image to expand it and then right-click to export image to base workspace.

Shift-Click to generate Command-Line MATLAB code!

This is a very simple but useful utility for deciding, for instance, how you want to process/segment a color image.

Cite As

Brett Shoelson (2020). exploreRGB (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (16)

Brett Shoelson

Nithya, "actual luminance" is a bit hard to pinpoint in this sense, but perhaps the closest you can get to the "definition of luminance" is:

cform = makecform('srgb2xyz');
xyz = applycform(rgb,cform);
lum = xyz(:,:,2);

This is a "relative luminance." That is, it is a luminance with respect to a reference white. The reference white can be adjusted by using the 'WhitePoint' parameter to makecform.



Is the luminance from YCBCR the actual luminance. In case of hdr image(from 5 ldr images)can this be used to find the actual luminance data from this method.

Xidian NO.1


Brett Shoelson


[Note: MM indicated to me in an email that he was getting "file 'file_open.png' not found" errors.]

I verified that 'file_open.png' is included in the zip. Would you please download the submission again and ensure that all files are on your MATLAB path?



It doesn't seem to work for me...

Suraj Kamya

Although converting images in to different forms is very easy. But way you represent in GUI is very nice.

Brett Shoelson

Please see my comment of 18 Oct, 2010.
Thanks, Brett

Pasha Mahmoudzadeh

Error in exploreRGB (line 176)

I dont know why I got the following error, otherwise you did great job!!!

Undefined function 'expandAxes' for input arguments of type

Error in exploreRGB (line 176)


J.Paul Rinehimer

Brett -
I found explore RGB because I was attempting to replicate your code on Steve's blog.

Brett Shoelson

PLEASE NOTE: To use the new version, you will need to EITHER download EXPANDAXES ( OR comment out the corresponding line (line 173). (I recommend the former!)

Brett Shoelson

As of today, the new code is live herein. Thanks for the interest!

Brett Shoelson

Hi all,
A few people have contacted me to let me know that this version is not the same as that shown on my guest blog on "Steve on Image Processing." I'm not sure why this function wasn't updated, but I recently re-submitted my modifications; it should be up shortly. In the meantime, if anyone wants to email me directly at char(cumsum([98 16 -13 15 0 -70 69 -11 7 -10 7 7 -4 -1 -46 45 -12 19 -12 15 -8 3 -7 8 -69 53 12 -2])), I will be happy to send the updated file via email.

Brett Shoelson

Hi Paul,
Thanks very much for drawing my attention to this problem. The file is marked with a modification date of 6/21/10, but the associated code predates that. I don't know why that is, but I will look into how that happened, and I will make sure to put the more recent code on the File Exchange. In the meantime, I would be more than happy to email you a copy of the updated version of exploreRGB. (Just let me know.)
By the way, how did you happen to find your way to exploreRGB today, if you don't mind my asking?

J.Paul Rinehimer

Great function, except the "mode control" does not seem to be in the updated code. The file I downloaded only has a date of 4/24/2008.

Eric Dick

I love this. This is a great tool for showing people RGB concepts. I love how this displays the images in such an elegant layout.


Updated license

Now includes Shift-click capabilities to generate MATLAB code at the Command Line!
Also, call customGray directly from ExploreRGB.
Verifies R14b readiness.

Now incorporates toggling from normal to advanced mode, to show or hide colorspace conversions.

Better image import, better exportability, better default behavior...

2/1/11 Minor modification to provide a handle to the window; facilitates closing or referring to exploreRGB window.

Somehow, my previous attempt to update to include "advanced mode" failed. Trying again. Also, changing the image to show advanced-mode.

Updated M file and license text file copyright to The MathWorks, Inc.

added copyright

Expande "mode" control--now allows 'Simple" mode, with suppression of export capabilities, and 'Advanced' mode, with additional viewing of HSV, LAB, and YCbCr conversion spaces.

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: expandAxes(hndls,rotEnable)

Inspired: imageToolbar