how to use hsv2rgb to remove lighting effects
5 views (last 30 days)
Show older comments
I have a set of rgb images with various illumination effects (shadows, glares etc.) I am trying to use rgb2hsv and then remove 'v' of hsv and recreate the image without the luminance component hoping it would reduce some of the above artifacts. I need this recreated image for the rest of my work. They have to be reconstructed without changing the original RGB chrominance values. I am trying to use rgb2hsv and hsv2rgb to do this task. But I am getting a black output (all values 0) when I recreate the image using hsv2rgb. Can somebody advice me what the error is? or any ideas on how to remove the above effects?
for n=firstframe:lastframe
originalRGB = imread(['image1.tiff'],n);% I have multiple frames in one image
end
hsvimage = rgb2hsv(originalRGB);
new_hsv(:,:,1) = hsvimage(:,:,1);%same h
new_hsv(:,:,2) = hsvimage(:,:,2);%same s
new_hsv(:,:,3) = zeros(size(hsvimage,1),size(hsvimage,2)); %make a matrix with size of the original hsvimage with all v values zero
new_rgb = hsv2rgb(new_hsv);
image(new_rgb)
thanks
0 Comments
Answers (1)
Image Analyst
on 29 Sep 2018
Your whole premise is wrong. Setting the whole image's v value to zero will certainly get rid of any lighting problems but it does it by setting the whole image to black. You will not see anything whatsoever. What you might try is first, to use polarizers to knock out some of the specular reflections, then, second, white balance your camera, and then if there is still some problems, try HDR or something similar to Photoshop's "Shadows/Highlights..." adjustment (Google it).
2 Comments
Image Analyst
on 29 Sep 2018
I didn't say to use Photoshop, I suggested using an algorithm like they use for Shadows and highlights, basically: threshold, apply piecewise intensity adjustment, and blend boundaries. Otherwise just develop your algorithm to be insensitive to blown out highlights.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!