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

 채택된 답변

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

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.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2017년 5월 25일

편집:

2020년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by