zoukankan      html  css  js  c++  java
  • 【代码备份】NLM插值

    文件路径:

    main.m:

    %% 测试函数
    clc,clear all,close all;
    %输入的原始小图
    ima_ori=double(imread('F:Users****nDocumentsMATLABTestImages标准图像monarch.bmp'));%原图
    
    ima=imresize(ima_ori,0.5,'nearest');%降采样图,待输入处理。在该原始分辨率图像中进行搜索窗确认,遍历进行匹配相似度计算
    %主功能函数
    search=1;%搜索窗半径大小
    patch=1;%匹配窗半径大小
    sigma=5; %高斯核分配权重:h
    ima1=imresize(ima,2,'bicubic');%初始升采样图中进行匹配窗口选取
    [wid,len,channels]=size(ima1);
    HRima=ima1;%大小需要注意!
    if channels>2    
        for k=1:channels 
           %原图小图输入
           %                                                                
           HRima(:,:,k)=NLmeansfilter(ima(:,:,k),ima1(:,:,k),search,patch,sigma);%调用的是插值后的大图。
        end
    end
    
    % show results 
    subplot(1,2,1),imshow(uint8(ima1)),title('original bicubic');
    subplot(1,2,2),imshow(uint8(HRima)),title('NLM Inter');
    imwrite(uint8(ima_ori),strcat('search=',num2str(search),'_patch=',num2str(patch),'_original','.tif'));
    imwrite(uint8(ima1),strcat('search=',num2str(search),'_patch=',num2str(patch),'_original_bicubic','.tif'));
    imwrite(uint8(HRima),strcat('search=',num2str(search),'_patch=',num2str(patch),'_NLM_Inter','.tif'));
    [PSNR_ori, MSE_ori] = psnr(ima1, ima_ori);       
    [PSNR_nlm, MSE_nlm] = psnr(HRima, ima_ori);

     monarch:

     

    耗时:

     

    psnr由28.4249->30.1206,提升了1.6957。

  • 相关阅读:
    C#开发模式——单例模式
    C#开发模式——单例模式
    Memcached的基础梳理
    Memcached的基础梳理
    Memcached的基础梳理
    Memcached的基础梳理
    13条只有程序员才能懂的内涵段子
    13条只有程序员才能懂的内涵段子
    网页性能优化
    webpack中使用ECharts
  • 原文地址:https://www.cnblogs.com/wxl845235800/p/10150809.html
Copyright © 2011-2022 走看看