How to eliminate this white haze when taking a photo?

6 views (last 30 days)
Hello
I want to know how can I eliminate this haze in the photo, I dont know if Its possible to eliminate this haze setting around the fiber from just phone camera adjustments or from matlab. I used a light box with "daylight" configuration. Is it possible to make it without altering the color?
Thanks in advance
  4 Comments
DGM
DGM on 13 Apr 2025
The subject regions near the bottom of the image frame are slightly and gradually obscured by scattered light bleeding in from the background, much like a diffuse haze cast by cataracts.
Image Analyst
Image Analyst on 13 Apr 2025
That could be near the opening of the light booth. Outside lab light could be getting into the front of the booth from the room or reflected off a lab coat the person is wearing. This is why we never use light booths that have an open side. All the light booths I design and use are completely sealed to totally exclude outside light, except for one system where the operator needs to put in samples so frequently that they refused to use a door. In that case I just made sure the booth lamps were bright enough to completely overwhelm the light coming in from the lab (6000 Lux where the lab was about 400 lux). The insides of my light booths are usually powder coated with flat white paint, except for a few where the situation required flat black paint because it was a dark field/scattered light situation. The only times were I don't use a light booth are where we're measuring physical things like width and height, or the images came from somewhere else, like a CT or MRI machine or microscope.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 12 Apr 2025
@DGM makes some good suggestions. Glare and haze are caused by excess bright light scattering around your camera's optical system, or (in outdoor situations) excess moisture (fog, humidity) in the air. You can reduct the excess light by photographing your textiles/fabrics on a black background. One of the best is black velvet. You'll see several types of black velvet in the fabric store so get the one that looks blackest and has the least amount of sheen to it. A less preferable alternative is black flannel or black posterboard. These cannot get anywhere near as black as black velvet though.
Next, obviously make sure your lens is as clean as it can be. It might help to move the camera lens around to see if any angle is better than the others in reducing glare or reflections.
Nothing you can do will do anything without altering the colors. Removing haze generally makes the colors more saturated (pure). You can perhaps reduce the appearance of haze and make the colors more vivid by calling rgb2hsv and then scaling the v channel with rescale
%--------------------------------------------------------------------------------------------------------
% READ IN TEST IMAGE
folder = [];
baseFileName = 'office_1.jpg';
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% The file doesn't exist -- didn't find it there in that folder.
% Check the entire search path (other folders) for the file by stripping off the folder.
fullFileNameOnSearchPath = baseFileName; % No path this time.
if ~exist(fullFileNameOnSearchPath, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
rgbImage = imread(fullFileName);
%--------------------------------------------------------------------------------------------------------
% Display the image.
subplot(2, 1, 1);
imshow(rgbImage);
impixelinfo;
axis('on', 'image');
title('Original RGB Image', 'FontSize', 11, 'Interpreter', 'None');
%--------------------------------------------------------------------------------------------
% Increase dynamic range.
hsvImage = rgb2hsv(rgbImage);
v = imadjust(hsvImage(:, :, 3)); % Expand brightness channel
hsvImage(:, :, 3) = v; % Put back in.
rgbImage2 = hsv2rgb(hsvImage); % Convert back to RGB color space
% Display the new image.
subplot(2, 1, 2);
imshow(rgbImage2);
impixelinfo;
axis('on', 'image');
title('New Image', 'FontSize', 11, 'Interpreter', 'None');
Be aware this changes the color because the brightness changed, however the hue doesn't change.
The biggest problem with changing colors comes from the fact that you said you are using a camera on your smartphone. Unless you do something to turn off all automatic adjustments (if that is even possible) then the camera is altering the image on its own to give you what it thinks will a pleasing photo. It is not interested in giving you accurate colors, just ones that look pretty. There is a ton of "computational photography" https://en.wikipedia.org/wiki/Computational_photography built into the smartphone cameras. If you are really interested in getting accurate (traceable back to spectrophotometers) color information (like I've been doing for the last 37 years) you will have to use a machine vision camera and turn off all kinds of automatic processing (you can do this with a scientifi/industrial machine vision camera). You cannot have the camera making up it's own mind, on a scene-to-scene basis how to change things like gain, exposure, color balance, etc. And then you still have to use a color standard, like the Calibrite Color Checker chart. See https://calibrite.com/us/product-category/photographers/
For haze removal links and methods see
Next, click on the magnifying glass on this page https://www.microsoft.com/en-us/research/ and search for haze and you'll see several publications that Microsoft has on the topic. Sorry, I do not have any MATLAB code for any of them.
  1 Comment
DGM
DGM on 13 Apr 2025
I do believe there are some haze estimation/reduction implementations on the FEX, though you know I'm still in the "fix it in physical" camp.

Sign in to comment.

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!