Gointerface接口声明实现及作用详解
332
2022-09-07
【图像融合】基于加权平均法实现图像融合含Matlab源码(图像融合算法)
1 简介
基于加权平均法实现图像融合含Matlab源码
2 完整代码
clearg_R=0;g_G=0;g_B=0;h_R=0;h_G=0;h_B=0;fenzi_R=0;fenzi_G=0;fenzi_B=0;fenmu_up_R=0;fenmu_up_G=0;fenmu_up_B=0;fenmu_low_R=0;fenmu_low_G=0;fenmu_low_B=0;tableR=[];tableG=[];tableB=[];up=imread('high.jpg'); %读图像low=imread('low.jpg');figure(1)imshow(up); %读RGB数值[M,N,color]=size(up);title('加权-RGB表示的高分辨率图像');figure(2)imshow(low); title('加权-RGB表示的低分辨率图像');r=double(up(:,:,1));g=double(up(:,:,2));b=double(up(:,:,3));r_low=double(low(:,:,1));g_low=double(low(:,:,2));b_low=double(low(:,:,3));RGB(:,:,1)=0.5*r+0.5*r_low;RGB(:,:,2)=0.5*g+0.5*g_low;RGB(:,:,3)=0.5*b+0.5*b_low;R=RGB(:,:,1);G=RGB(:,:,2);B=RGB(:,:,3);RGB=uint8(round(RGB)); figure(3)imshow(RGB)title('加权-RGB转化后的图像'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 下面是计算平均梯度G % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for ii=1:M-1 for jj=1:N-1 g_R=g_R+sqrt((((r(ii+1,jj)-r(ii,jj))^2+(r(ii,jj+1)-r(ii,jj))^2))/2); g_G=g_G+sqrt((((g(ii+1,jj)-g(ii,jj))^2+(g(ii,jj+1)-g(ii,jj))^2))/2); g_B=g_B+sqrt((((b(ii+1,jj)-b(ii,jj))^2+(b(ii,jj+1)-b(ii,jj))^2))/2); endendfprintf('\n\n highR的清晰度为:%.4f\n highG的清晰度为:%.4f\n highG的清晰度为:%.4f',... g_R/(M-1)/(N-1),g_G/(M-1)/(N-1),g_B/(M-1)/(N-1)); g_R=0;g_G=0;g_B=0;for ii=1:M-1 for jj=1:N-1 g_R=g_R+sqrt((((r_low(ii+1,jj)-r_low(ii,jj))^2+(r_low(ii,jj+1)-r_low(ii,jj))^2))/2); g_G=g_G+sqrt((((g_low(ii+1,jj)-g_low(ii,jj))^2+(g_low(ii,jj+1)-g_low(ii,jj))^2))/2); g_B=g_B+sqrt((((b_low(ii+1,jj)-b_low(ii,jj))^2+(b_low(ii,jj+1)-b_low(ii,jj))^2))/2); endendfprintf('\n\n lowR的清晰度为:%.4f\n lowG的清晰度为:%.4f\n lowG的清晰度为:%.4f',... g_R/(M-1)/(N-1),g_G/(M-1)/(N-1),g_B/(M-1)/(N-1)); g_R=0;g_G=0;g_B=0;for ii=1:M-1 for jj=1:N-1 g_R=g_R+sqrt((((R(ii+1,jj)-R(ii,jj))^2+(R(ii,jj+1)-R(ii,jj))^2))/2); g_G=g_G+sqrt((((G(ii+1,jj)-G(ii,jj))^2+(G(ii,jj+1)-G(ii,jj))^2))/2); g_B=g_B+sqrt((((B(ii+1,jj)-B(ii,jj))^2+(B(ii,jj+1)-B(ii,jj))^2))/2); endendfprintf('\n\n resultR的清晰度为:%.4f\n resultG的清晰度为:%.4f\n resultG的清晰度为:%.4f',... g_R/(M-1)/(N-1),g_G/(M-1)/(N-1),g_B/(M-1)/(N-1));
3 仿真结果
4 参考文献
[1]胡涛, 汪强, 张志刚. 基于Matlab的图像融合方法[J]. 计算机工程, 2003, 29(14):2.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~