Is there any way to convert an image from RGB to CIELUV colorspace? Or read an image in CIELUV colorspace? For details about CIELUV colorspace refer : https://en​.wikipedia​.org/wiki/​CIELUV

10 views (last 30 days)
I am trying to read an image in CIELUV colorspace format, but failed. I tried reading the image as RGB and using colorspace function to convert to LUV but still nothing turned up. Thanks in advance! :)

Answers (2)

Image Analyst
Image Analyst on 1 Apr 2016
Use the formulas on easyrgb.com: http://www.easyrgb.com/index.php?X=MATH
First go from RGB to XYZ, then from XYZ to CIE L*UV
  2 Comments
Manasi
Manasi on 1 Apr 2016
I have extracted the colorspace file extension from the site. Can you help me to figure out where the extracted file should be present?
Image Analyst
Image Analyst on 1 Apr 2016
From what site? Your image should be on your hard drive. I would imagine you'd want to save any extracted file to your hard drive also.

Sign in to comment.


DGM
DGM on 5 Jan 2024
There are tools on the File Exchange which can do both transformations.
Pascal Getreuer's colorspace() offers conversions in both MEX and M-code. It is no longer maintained, and there are a few particular issues, but none of them should affect LUV conversions. See the FEX comments for details.
% an image presumed to be in sRGB
rgbpict = imread('peppers.png');
% rgb to luv using Pascal Getreuer's colorspace()
luvpict = colorspace('rgb->luv',rgbpict);
The conversion tools that come with MIMT can also do the work, though for my own reasons (i.e. chroma constraint in the inverse transformation), the primary conversion is done into the polar model, so an extra step is needed if you want a plain rectangular representation of LUV.
% an image presumed to be in sRGB
rgbpict = imread('peppers.png');
% rgb to lchuv using MIMT rgb2lch()
lchpict = rgb2lch(rgbpict,'luv');
% lchuv to luv using MIMT lch2lab()
% despite the name, this is not converting to CIELAB
% it's just a polar-rectangular conversion
luvpict = lch2lab(lchpict);
If the work can be done in the polar model, then the extra conversion isn't necessary.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!