资源简介

超分辨率图像处理,matlab源码,效果远远优于三次插值

资源截图

代码片段和文件信息

function [SupResol] = SuperresCode(Low MFactor ColorProcMethod Model)

if nargin < 4
    load MatlabR2007aSupResModel.mat;
end
if nargin < 3
    ColorProcMethod = ‘L‘;
end

BoundarySize = 9;
warning off;
BiC = imresize(LowMFactor ‘bicubic‘);
warning on;
BiC = padarray(BiC [BoundarySizeBoundarySize] ‘symmetric‘‘both‘);
[SupResol] = SuperresMexInt(BiC MFactor ColorProcMethod Model);
SupResol = SupResol(BoundarySize+1:end-BoundarySizeBoundarySize+1:end-BoundarySize:);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [SupResol] = SuperresMexInt(BiC MFactor ColorProcMethod Model)

[IHeightIWidthColorDim] = size(BiC);

if ColorDim > 1 %%% if color
    if ColorProcMethod == ‘C‘
    %%% proc. each RGB channel independently
        RBiC = BiC(::1);
        GBiC = BiC(::2);
        BBiC = BiC(::3);
        SupResol = zeros(size(BiC));
        [SupResol(::1)] = SuperresMexInt(RBiC MFactor ColorProcMethod Model);
        [SupResol(::2)] = SuperresMexInt(GBiC MFactor ColorProcMethod Model);
        [SupResol(::3)] = SuperresMexInt(BBiC MFactor ColorProcMethod Model);
    %%% proc. each RGB channel independently 
    else
    %%% proc. luminance component only
        CBiC = double(BiC)/255;
        YIQ = rgb2ntsc(CBiC);
        Lum = YIQ(::1);
        [SupResolLum] = SuperresMexInt(Lum*255 MFactor ColorProcMethod Model);
        YIQ(::1) = SupResolLum/255;
        SupResol = ntsc2rgb(YIQ);
        SupResol = SupResol*255;
    %%% proc. luminance component only
    end
else
    BiC = double(BiC)/255*2-1;
    if MFactor == 2
        [SupResol] = SuperresCodeMex(BiC Model.M2 MFactor);
    elseif MFactor == 3
        [SupResol] = SuperresCodeMex(BiC Model.M3 MFactor);
    elseif MFactor == 4
        [SupResol] = SuperresCodeMex(BiC Model.M4 MFactor);
    else
        display(‘Mag. factor should be [234].‘);
        return;
    end
    SupResol = (SupResol+1)/2*255;
end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       36864  2010-03-20 13:26  SuperresCodeMex.mexw64
     文件         435  2008-06-22 10:43  Test.m
     文件         185  2008-06-21 23:41  Usage.txt
     文件       40054  2008-04-30 08:50  Butterfly.bmp
     文件      203416  2011-06-24 09:55  HighResol.png
     文件     1628311  2008-06-22 07:53  MatlabR2007aSupResModel.mat
     文件        2110  2008-06-22 10:47  SuperresCode.m
     文件       26271  2008-07-02 13:28  SuperresCodeMex.mexa64
     文件       26648  2008-07-02 13:28  SuperresCodeMex.mexglx
     文件       28672  2008-07-02 13:28  SuperresCodeMex.mexw32

评论

共有 条评论