Open fayazdharejo opened 4 years ago
Hi, thanks for your question. The code is working on GPU, if you choose non-local haze-line prior to calculate the atmospheric light. If you run the code on PC, you can reference my another dehazing demo, https://github.com/phoenixtreesky7/mof_dehazing/blob/master/mof_demo.m, by setting the method.A = 0. I will update the code of iders_demo.m in my github, thank you again.
-------------------------replace the following codes with the tree lines you have aforementioned--------------------------- method.A = 0 if ~method.A % -- DCP A -- % dark = dcp(image_hazy, 25); numpx = floor(PixleNumber(pic) / 1000); J_dark_vec = reshape(dark, PixleNumber(pic), 1); I_vec = reshape(image_hazy, PixleNumber(pic), 3);
[J_dark_vec, indices] = sort(J_dark_vec);
indices = indices(PixleNumber(pic) - numpx + 1 : end);
atmSum = zeros(1, 3);
for ind = 1 : numpx
atmSum = atmSum + I_vec(indices(ind), : );
end
dcp_A = atmSum / numpx;
A(pic,:) = dcp_A;
% display of dcp_A
% dcp_A_figure(:, :, 1) = dcp_A(1) * ones(50 * 50);
% dcp_A_figure(:, :, 2) = dcp_A(2) * ones(50 * 50);
% dcp_A_figure(:, :, 3) = dcp_A(3) * ones(50 * 50);
% figure,imshow([dcp_A_figure])
% saveName = [path_MOF 'mof_' num2str(pic) '_A_dcp' '.png'];
% imwrite(dcp_A_figure, saveName);
else
% -- Haze-Line A -- %
%
gamma = 1;
image_hazy_downsample = image_hazy(1:4:end, 1:4:end, :);
[ hazeline_A ] = reshape( estimate_airlight(
image_hazy_downsample.^gamma, gpu_ava), 1, 1, 3 ); A(pic, :) = hazeline_A;
% display of hazeline_A
% hazeline_A(pic, :)_figure(:,:,1) = hazeline_A(pic,
:)(1)ones(5050); % hazeline_A(pic, :)_figure(:,:,2) = hazeline_A(pic, :)(2)ones(5050); % hazeline_A(pic, :)_figure(:,:,3) = hazeline_A(pic, :)(3)ones(5050); % figure,imshow([hazeline_A(pic, :)_figure]) % saveName = [pathMOF 'mof' num2str(pic) '_A_hl' '.png']; % imwrite(hazeline_A(pic, :)_figure, saveName); end
fayazdharejo notifications@github.com 于2019年8月4日周日 下午7:56写道:
[image: image] https://user-images.githubusercontent.com/44371159/62423297-d517ef80-b6f1-11e9-9ce6-483d50d1d2a3.png
I think demo code has error, please have look to the demo file please.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/phoenixtreesky7/iders_dehazing/issues/1?email_source=notifications&email_token=ADMDXFDRBMVCEBVH3WMDXW3QC27YJA5CNFSM4IJFDH72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HDHP7LQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMDXFAVQDDZRIEOVT5OHHLQC27YJANCNFSM4IJFDH7Q .
Sorry, you also need add a parameter gpu_ava = 1, before the if ~method.A ...
ZHAO DONG jasminephoenixtree@gmail.com 于2019年8月27日周二 下午4:06写道:
Hi, thanks for your question. The code is working on GPU, if you choose non-local haze-line prior to calculate the atmospheric light. If you run the code on PC, you can reference my another dehazing demo, https://github.com/phoenixtreesky7/mof_dehazing/blob/master/mof_demo.m, by setting the method.A = 0. I will update the code of iders_demo.m in my github, thank you again.
-------------------------replace the following codes with the tree lines you have aforementioned--------------------------- method.A = 0 if ~method.A % -- DCP A -- % dark = dcp(image_hazy, 25); numpx = floor(PixleNumber(pic) / 1000); J_dark_vec = reshape(dark, PixleNumber(pic), 1); I_vec = reshape(image_hazy, PixleNumber(pic), 3);
[J_dark_vec, indices] = sort(J_dark_vec); indices = indices(PixleNumber(pic) - numpx + 1 : end); atmSum = zeros(1, 3); for ind = 1 : numpx atmSum = atmSum + I_vec(indices(ind), : ); end dcp_A = atmSum / numpx; A(pic,:) = dcp_A; % display of dcp_A % dcp_A_figure(:, :, 1) = dcp_A(1) * ones(50 * 50); % dcp_A_figure(:, :, 2) = dcp_A(2) * ones(50 * 50); % dcp_A_figure(:, :, 3) = dcp_A(3) * ones(50 * 50); % figure,imshow([dcp_A_figure]) % saveName = [path_MOF 'mof_' num2str(pic) '_A_dcp' '.png']; % imwrite(dcp_A_figure, saveName); else % -- Haze-Line A -- % % gamma = 1; image_hazy_downsample = image_hazy(1:4:end, 1:4:end, :); [ hazeline_A ] = reshape( estimate_airlight(
image_hazy_downsample.^gamma, gpu_ava), 1, 1, 3 ); A(pic, :) = hazeline_A;
% display of hazeline_A % hazeline_A(pic, :)_figure(:,:,1) = hazeline_A(pic,
:)(1)ones(5050); % hazeline_A(pic, :)_figure(:,:,2) = hazeline_A(pic, :)(2)ones(5050); % hazeline_A(pic, :)_figure(:,:,3) = hazeline_A(pic, :)(3)ones(5050); % figure,imshow([hazeline_A(pic, :)_figure]) % saveName = [pathMOF 'mof' num2str(pic) '_A_hl' '.png']; % imwrite(hazeline_A(pic, :)_figure, saveName); end
fayazdharejo notifications@github.com 于2019年8月4日周日 下午7:56写道:
[image: image] https://user-images.githubusercontent.com/44371159/62423297-d517ef80-b6f1-11e9-9ce6-483d50d1d2a3.png
I think demo code has error, please have look to the demo file please.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/phoenixtreesky7/iders_dehazing/issues/1?email_source=notifications&email_token=ADMDXFDRBMVCEBVH3WMDXW3QC27YJA5CNFSM4IJFDH72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HDHP7LQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMDXFAVQDDZRIEOVT5OHHLQC27YJANCNFSM4IJFDH7Q .
I think demo code has error, please have look to the demo file please.