How to code HSV to RGB spaces images matlab?

6 views (last 30 days)
Hello please help me,
First of all my code on matlab is converting RGB images to HSV color space, and i use Adaptive Image Enhancement for Increasing Value, and then i confused when i must to converting again from HSV color space to RGB spaces, can you help me with the code? here i give you code when i converting the RGB to HSV. Thanks
img = imread('tes2.jpg');
HSV = rgb2hsv(img);
hueValue = HSV(:,:,1);
saturationValue = HSV(:,:,2);
Value = HSV(:,:,3);

Answers (1)

Image Analyst
Image Analyst on 28 Nov 2019
Something like (untested):
rgbImage = imread('tes2.jpg');
HSV = rgb2hsv(rgbImage);
hueValue = HSV(:,:,1);
saturationValue = HSV(:,:,2);
Value = HSV(:,:,3);
Value = adapthisteq(Value); % Or your own custom function.
% Put back together
HSV = cat(3, hueValue, saturationValue, Value);
rgbOutput = hsv2rgb(HSV);

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!