This package consists of 3 files: rgb2hsl.m, hsl2rgb.m, and hsltest.m. The first two perform color conversion between HSL and RGB color spaces for 1d and 2d arrays(images). The last file includes unit tests for conversion.
Vladimir Bychkovsky (2020). hsl2rgb and rgb2hsl conversion (https://www.mathworks.com/matlabcentral/fileexchange/20292-hsl2rgb-and-rgb2hsl-conversion), MATLAB Central File Exchange. Retrieved .
works perfect, thank you!
I'm using it in Matlab 2016 to convert a colormap from RGB to HSL and it's working perfectly!
These conversion tools work fine. Read the synopsis. The inputs need to be of class 'double' or with data range of [0 1].
If you have IPT installed, you can simply use im2double() or to convert any standard image to 'double'.
If you don't have IPT, just do double(mypictureofthings)./255
Strangely enough, in R2009b this code fails silently when fed a uint8 image, but R2015b actually produces an error message. Furthermore, this seems to work fine for 'single' images in R2009b, but not in R2015b. This might be part of the confusion, and is likely due to changes to the built-in HSV conversion tools.
Works just great, not sure why this isn't implemented in MATLAB directly.
hsl2rgb and rgb2hsl conversion do NOT work...
hsl = rgb2hsl(double(I)./256);
where I is the uint8 image you just opened with imread
The command rgb2hsl doesnt work in matlab 2016. One member has put a comment that it needs to be converted to double instead of uint8. But how can I do this. please help me.
Thanks but this does not work in Matlab2016
rgb2hsl is not working
then what should i do sir.?
rgb2hsl is not working properly. It needs to convert the results of some operations to double format instead of uint8
Works as advertised