拉普拉斯金字塔图像融合的具体matlab程序.docVIP

  • 3
  • 0
  • 约2.3千字
  • 约 4页
  • 2023-03-07 发布于湖北
  • 举报

拉普拉斯金字塔图像融合的具体matlab程序.doc

拉普拉斯金字塔图像融合的具体matlab程序 function lap_fusion() %Laplacian Pyramid fusion mul= imread(images\ms1.png); pan= imread(images\pan.png); figure(1); imshow(mul);title(MS原始图像);axis fill; figure(2); imshow(pan);title(Pan原始图像);axis fill; mul = double(rgb2gray(mul))/255; pan = double(rgb2gray(pan))/255; %普拉斯金塔变换参数 mp = 1;zt =4; cf =1;ar = 1; cc = [cf ar]; Y_lap = fuse_lap(mul,pan,zt,cc,mp); figure(3); imshow(Y_lap);title(lap fusion 后的图像);axis fill; imwrite(Y_lap,images\lap fusion后的图像.jpg,Quality,100); %main function end function Y = fuse_lap(M1, M2, zt, ap, mp) %Y = fuse_lap(M1, M2, zt, ap, mp) image fusion with laplacian pyramid % % M1 - input image A % M2 - input image B % zt - maximum decomposition level % ap - coefficient selection highpass (see selc.m) % mp - coefficient selection base image (see selb.m) % % Y - fused image % (Oliver Rockinger 16.08.99) % check inputs [z1 s1] = size(M1); [z2 s2] = size(M2); if (z1 ~= z2) | (s1 ~= s2) error(Input images are not of same size); end; % define filter w = [1 4 6 4 1] / 16; % cells for selected images E = cell(1,zt); % loop over decomposition depth - analysis for i1 = 1:zt % calculate and store actual image size [z s] = size(M1); zl(i1) = z; sl(i1) = s; % check if image expansion necessary if (floor(z/2) ~= z/2), ew(1) = 1; else, ew(1) = 0; end; if (floor(s/2) ~= s/2), ew(2) = 1; else, ew(2) = 0; end; % perform expansion if necessary if (any(ew)) M1 = adb(M1,ew); M2 = adb(M2,ew); end; % perform filtering G1 = conv2(conv2(es2(M1,2), w, valid),w, valid); G2 = conv2(conv2(es2(M2,2), w, valid),w, valid); % decimate, undecimate and interpolate M1T = conv2(conv2(es2(undec2(dec2(G1)), 2), 2*w, valid),2*w, valid); M2T = conv2(conv2(es2(undec2(dec2(G2)), 2), 2*w, valid),2*w, valid); % select coefficients and store them E(i1) = {selc(M1-M1T, M2-M2T, ap)}; % decimate M1 = dec2(G1); M2 = dec2(G2); end; % select base coefficients of last decompostion stage M1 = selb(M1,M2,mp); % loop o

文档评论(0)

1亿VIP精品文档

相关文档