Skip to content

Instantly share code, notes, and snippets.

@pollend
Last active March 1, 2018 08:10
Show Gist options
  • Select an option

  • Save pollend/5901b8efe37dae98990ed45ad5d12043 to your computer and use it in GitHub Desktop.

Select an option

Save pollend/5901b8efe37dae98990ed45ad5d12043 to your computer and use it in GitHub Desktop.
%http://kaiminghe.com/cvpr09/comparisons.html
%http://www.meo.etc.upt.ro/AncutiProjectPages/D_Hazzy_ICIP2016/
image = imread('./images_final/6.png');
hsv_image = rgb2hsv(image);
[sizex, sizey] = size(image);
theta_0 = 0.121779;
theta_1 = 0.959710;
theta_2 = -0.780245;
deviation = 0.041337;
depth = theta_0 + theta_1*hsv_image(:,:,3)+ theta_2*hsv_image(:,:,2);
imshow(depth);
figure;
t_min = min(max(exp(-depth),.1),.9);
image_scaled = double(image)/255.0;
grayscale = double(rgb2gray(image))/255;
order_depth = sort(depth(:),'descend');
min_range = min(order_depth(1:int64((sizex* sizey)*.001)));
A = max(max((depth < min_range) .*grayscale));
fprintf('Attenuation:%d \n', A)
for i = 1:3
image_scaled(:,:,i) = ((image_scaled(:,:,i)-A) ./ t_min) + A;
end
subplot(1,2,1);
imshow(uint8(image_scaled * 255));
subplot(1,2,2);
imshow(image);
%
%image = hsv2rgb(image);
%imshow(image);
sources:
http://ieeexplore.ieee.org/document/7128396/
http://webee.technion.ac.il/~yoav/publications/hazecvpr.pdf
http://www.eng.tau.ac.il/~berman/NonLocalDehazing/
https://arxiv.org/pdf/1510.01018.pdf
http://kaiminghe.com/cvpr09/comparisons.html
http://www.meo.etc.upt.ro/AncutiProjectPages/D_Hazzy_ICIP2016/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment