Skip to content

Commit

Permalink
Create image_blending_average.m
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaqi LYU authored Nov 12, 2017
1 parent 3112783 commit b99512f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions image_blending_average.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function [output_canvas] = image_blending_average(warped_img1,warped_img2)
% 平均融合
w1 = imfill(im2bw(uint8(warped_img1), 0),'holes');
w2 = imfill(im2bw(uint8(warped_img2), 0),'holes');

w1 = mat2gray(w1);
w2 = mat2gray(w2);

warped_img1 = double(warped_img1);
warped_img2 = double(warped_img2);
output_canvas(:,:,1) = ((warped_img1(:,:,1).*w1)+(warped_img2(:,:,1).*w2))./(w1+w2);
output_canvas(:,:,2) = ((warped_img1(:,:,2).*w1)+(warped_img2(:,:,2).*w2))./(w1+w2);
output_canvas(:,:,3) = ((warped_img1(:,:,3).*w1)+(warped_img2(:,:,3).*w2))./(w1+w2);
output_canvas = uint8(output_canvas);
end

0 comments on commit b99512f

Please sign in to comment.