Adding haze to image

回答 (3 件)

Image Analyst
Image Analyst 2016 年 10 月 25 日
編集済み: Thorsten 2016 年 10 月 25 日

1 投票

Use rand() to add an offset and a slight amount of noise. ofr a grayscale image, try this:
maxGL = max(grayImage(:));
hazyImage = uint8(double(grayImage) + 240 - maxGL + 10 * rand(size(grayImage)));
figure;
subplot(1, 2, 1);
imshow(grayImage);
subplot(1, 2, 2);
imshow(hazyImage);

6 件のコメント

hussein ali
hussein ali 2016 年 10 月 25 日
I do not know how I thank you , thank you very much , but this does not work I have research and I need your help please
Image Analyst
Image Analyst 2016 年 10 月 25 日
Well I think it does work but maybe you don't think it's realistic enough. In that case I invite you to look at the Vision Lab at the University of Dayton that does research into fog and haze removal. Perhaps if you know how it's removed you can learn what constitutes realistic haze and you can generate it. See this link University of Dayton Vision Lab.
hussein ali
hussein ali 2016 年 10 月 31 日
Again many many thanks my teacher for your answer
hussein ali
hussein ali 2016 年 11 月 24 日
my teacher Thorsten May I know why use 240 thank you
Image Analyst
Image Analyst 2016 年 11 月 24 日
I'm not Thorsten but since the 240 was in my code I'll answer anyway. Basically I wanted to brighten the image and add a bit of noise to make it look hazy.
I subtracted maxGL to get the image all negative.
Then I added up to 10 gray levels of noise. So now the gray levels go from large negative up to as much as 10.
Then I added 240 to brighten the image. Whatever the old max was, it will now be at 240. For example it might have been at 130 - doesn't matter - now it will be at 240 so it looks brighter. Then there's still the 10 gray levels of noise on top of that so the image goes to as bright as 250 gray levels. You can change the 240 to be whatever you want, to map the old max brightness to a new level.
hussein ali
hussein ali 2017 年 1 月 23 日
Thank you so much my teacher

サインインしてコメントする。

Amjad Mushtaq
Amjad Mushtaq 2022 年 6 月 2 日
編集済み: Walter Roberson 2022 年 9 月 19 日

0 投票

image=imread('image2.jpg');
subplot(2,2,1); imshow(image);title('imege');
a=imcomplement(image);
subplot(2,2,2);imshow(a);title('incomplement');
b=imreducehaze(a); % this is hazy filter code
subplot(2,2,3);imshow(b);title('hazy filter');

1 件のコメント

Walter Roberson
Walter Roberson 2022 年 6 月 2 日
Ah, but the question was how to add haze, not how to remove it.

サインインしてコメントする。

GNANA PRAKASH
GNANA PRAKASH 2022 年 9 月 19 日

0 投票

maxGL = max(grayImage(:));
hazyImage = uint8(double(grayImage) + 240 - maxGL + 10 * rand(size(grayImage)));
figure;
subplot(1, 2, 1);
imshow(grayImage);
subplot(1, 2, 2);
imshow(hazyImage);

質問済み:

2016 年 10 月 25 日

編集済み:

2022 年 9 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by