How to add haze to color image?I would like make variety of synthetic haze level in color image. Thank you

How to add haze to color image?I would like make variety of synthetic haze level in color image. Thank you

 Accepted Answer

Add white to the image, then rescale the intensity if you want. You could also make it a tiny bit noisy to make it more realistic.

5 Comments

Thank you for your reply. Can you give some code example?
Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
rgbImage = imread('peppers.png');
[rows, columns, numberOfColorChannels] = size(rgbImage)
subplot(2, 1, 1);
imshow(rgbImage);
title('Original Image', 'FontSize', fontSize);
maxValue = double(max(rgbImage(:)))
rgbImage2 = double(rgbImage) + 100; % Add white
% Get new max value.
maxValue2 = max(rgbImage2(:))
% Scale to original intensity range.
rgbImage2 = uint8(rgbImage2 * maxValue / maxValue2);
subplot(2, 1, 2);
imshow(rgbImage2);
title('Hazy Image', 'FontSize', fontSize);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
See attached new version which also adds noise to the haziness.

Sign in to comment.

Categories

Asked:

on 25 May 2017

Edited:

on 8 May 2020

Community Treasure Hunt

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

Start Hunting!