Hazy image equation implementation.

4 ビュー (過去 30 日間)
Silpa K
Silpa K 2019 年 10 月 20 日
I have an hazy image equation. When I am try to implement that equattion I only get a black image only.
Screenshot (48).png
This is my equation. How can I implement this equation in matlab correctly.Please help me.
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 20 日
Can you define A and t(x)?

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

回答 (2 件)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2019 年 10 月 20 日
編集済み: Thiago Henrique Gomes Lobato 2019 年 10 月 20 日
Can it be possible that you are just making a wrong conversion of your image data? With the code below I show an example of what would be a right and wrong conversion, besides this the code seems to work :
rng default
% Image and parameters
I = imread('cameraman.tif');
A = 0.5;
t = randn(size(I)); % t must have same dimensions as I
t = abs(t)/max(abs(t(:)))*0.7+0.3; % Normalize so no division by zero value possible
Hazy = @(I,A,t) (I-A*(1-t))./t; % Define your function, make sure it is element-wise
% Wrong Image conversion
J1 = Hazy(double(I),A,t);
% Right image conversion
J2 = Hazy(im2double(I),A,t);
figure,
subplot(1,3,1)
imshow(J1)
subplot(1,3,2)
imshow(I)
subplot(1,3,3)
imshow(J2)
If you have a RGB image, make sure to apply it individually to every third dimension of your image matrix.
  4 件のコメント
Silpa K
Silpa K 2019 年 10 月 23 日
Sir, the following link is provided my dataset.
I use the '7.1.09' this image from that.
Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2019 年 10 月 25 日
The problem was that you was defining your filter as a function of the image values before converting to normalize doubles, so your t had some crazy negative values and produced the black image. The following code works:
clc
clear
rng default
% Image and parameters
M= imread('5.3.02.tiff');
I=im2double(M);
tot = sum(double(I(:)));
[K L] = size(I);
A=((1./(K*L))*tot);
SD=std2(I);
t1= (I./A);
t2= SD * t1;
t= 1-t2;
Hazy = @(I,A,t) (I-A*(1-t))./t; % Define your function, make sure it is element-wise
J1 = Hazy(I,A,t);
figure,
subplot(1,2,1)
imshow(J1,[])
subplot(1,2,2)
imshow(I,[])
Untitled.png

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


Image Analyst
Image Analyst 2019 年 10 月 20 日
Chances are that your image is floating point and you forgot to put [] in imshow.
imshow(yourImage, []);

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by