精华内容
下载资源
问答
  • 一本反卷积非常经典的书 希望能帮到有需要的朋友 非代码
  • Matlab:盲反卷积还原失焦图像目录输出结果实现代码%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 盲反卷积还原失焦图像 % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I = imread('G...

    Matlab:盲反卷积还原失焦图像

    目录

    输出结果

    a8fc2d87c70ef1556aeedfa794a3ba56.png

    实现代码

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 盲反卷积还原失焦图像 % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I = imread('G:BaiduNetdiskDownload5.jpg'); I=rgb2gray(I) PSF=fspecial('gaussian',7,30); Blurred=imfilter(I,PSF,'symmetric','conv'); figure;imshow(Blurred);title('失焦图像'); UNDERPSF = ones(size(PSF)-4); [J1 P1] = deconvblind(Blurred,UNDERPSF); figure;imshow(J1);title('Deblurring with Undersized PSF'); OVERPSF = padarray(UNDERPSF,[4 4],'replicate','both'); [J2 P2] = deconvblind(Blurred,OVERPSF); figure;imshow(J2);title('Deblurring with Oversized PSF'); INITPSF = padarray(UNDERPSF,[2 2],'replicate','both'); [J3 P3] = deconvblind(Blurred,INITPSF); figure;imshow(J3);title('Deblurring with INITPSF'); figure; subplot(221);imshow(P1,[],'InitialMagnification','fit'); title('重建 Undersized PSF'); subplot(222);imshow(P2,[],'InitialMagnification','fit'); title('重建 Oversized PSF'); subplot(223);imshow(P3,[],'InitialMagnification','fit'); title('重建 init PSF'); WEIGHT = edge(I,'sobel',.3); se = strel('disk',2); WEIGHT = 1-double(imdilate(WEIGHT,se)); WEIGHT([1:3 end-[0:2]],:) = 0; WEIGHT(:,[1:3 end-[0:2]]) = 0; figure;imshow(WEIGHT);title('Weight array'); [J P] = deconvblind(Blurred,INITPSF,30,[],WEIGHT); figure;imshow(J);title('复原图像'); P1 = 2; P2 = 2; FUN = @(PSF) padarray(PSF(P1+1:end-P1,P2+1:end-P2),[P1 P2]); [JF PF] = deconvblind(Blurred,OVERPSF,30,[],WEIGHT,FUN); figure;imshow(JF);title('复原图像'); displayEndOfDemoMessage(mfilename)

    展开全文
  • MATLAB代码执行从平面波全息图重构的复数值波前的迭代3d反卷积,体积反卷积 引用此代码/算法或其任何部分: 塔蒂亚娜(Tatiana Latychevskaia),法比安·格里(Fabian Gehri)和汉斯·沃纳·芬克(Hans-Werner ...
  • MATLAB卷积

    千次阅读 2019-04-14 10:35:42
    文章目录卷积相关卷积定理卷积与互相关,自相关函数的关系卷积...反卷积:deconv(y,h)=x 相关卷积定理 卷积与互相关,自相关函数的关系 条件:假设系统的输入,输出,和单位脉冲响应分别为x(n), y(n), h(n). R...

    卷积的物理意义

    输入信号通过一个新兴因果移不变系统后的输出为信号与该系统的冲击响应的卷积。任何一个信号都可以表示为单位冲击信号之和。

    相关卷积定理

    卷积与互相关,自相关函数的关系

    条件:假设系统的输入,输出,和单位脉冲响应分别为x(n), y(n), h(n).
    Rxy(m) = Rxx(m)*h(m)
    对上式进行傅里叶变换,得:
    Sxy(w) = Sxx(w)*H(jw)

    卷积与单位脉冲响应的关系

    x(t)*δ(t) = x(t)
    x(t)*δ(t-t0) = x(t-t0)

    卷积的计算

    卷积向量表示形式

    一方不动,另一方前后倒置,从左向右移动,每次移动后重叠部分的乘积,再组合起来即输出信号

                      h1  h2  h3
    x4  x3  x2  x1
    

    已知:
    输入信号:x=[x1,x2,x3,x4] 维度:4
    系统响应:h=[h1,h2,h3] 维度:3
    输出信号:y=[y1,y2,y3,y4,y5,y6] 维度:4+3-1=6

    其中:

    y1=x1*h1
    y2=x1*h2+x2*h1
    y3=x1*h3+x2*h2+x3*h1
    y4=x2*h3+x3*h2+x4*h1
    y5=x3*h3+x4*h2
    y6=x4*h3
    

    卷积矩阵表达形式

    将上式写成矩阵形式:
    法一:
    在这里插入图片描述
    法二 :
    在这里插入图片描述

    基于法一,用MATLAB求X矩阵的三种方法

    
    % 功能:用上述的法一用三种方法求X大矩阵
    
    % 编辑者:lily
    % 日期:2019,4,14
    
    clear;
    clc;
    close all;
    % ======================= input signal ==========================
    x=[1,2,3,4];
    h=[5,6,7];
    %求矩阵的向量个数
    xn=size(x,2);%求矩阵列数,即几个
    hn=size(h,2);
    % ============================ 方法1 ====================================
    % 原理:按列放
    X=zeros(xn+hn-1, hn);%初始化大矩阵
     
    % 观察列的补0规律,求大矩阵X
    for  ind=1:hn
          xi= [zeros(hn-ind,1);x';zeros(ind-1,1)];
          X(:,ind)=xi;
    end
     
    Y_noconv=X*rot90(h);
    Y_noconv = Y_noconv';
    conv=conv(x,h);
    % ============================ 方法2 ====================================
    % 原理:元素一个一个放
    X=zeros(xn+hn-1, hn);%初始化大矩阵
    for c = hn:-1:1       % 换列
      s = hn - c + 1;     % 从第几行开始放
      m = 1;
      for r = s:s + xn - 1 % 换行放元素
        X(r,c) = x(m);
        m = m + 1;
      end
    end
    % ============================ 方法3 ====================================
    % 原理:circshift(x, A).将列矩阵往下移动A个数,将其挪到上面
    
    %第一列的0的个数
    Mzeros=zeros(1, hn-1);
    %第一列元素
    Xvec=[Mzeros, x]';
    %构造大矩阵
    Xmat = [Xvec];
    for c = 1:hn-1
      Xvec_shift = circshift(Xvec, -c);
      Xmat = [Xmat,Xvec_shift];
    end
    
    

    线性系统三个参数,已知两个求另外一个

    条件:假设系统的输入,输出,和单位脉冲响应分别为x(n), y(n), h(n).

    % 功能:输入信号:x,系统响应h,输出信号y。根据两个求一个
    % 用conv,deconv函数,或者写出大矩阵,用矩阵乘法求解
    
    % 编辑者:lily
    % 日期:2019,4,14
    
    clear;
    clc;
    close all;
    % ============================ 已知x,h,求y ====================================
    
    x=[1,2,3,4];
    h=[5,6,7];
    y = conv(x,h);  % or y = conv(h,x);
    
    % ============================ 已知x,y,求h ====================================
    h1 = deconv(y,x);
    % ============================ 已知h,y,求x ====================================
    x1 = deconv(y,h);
    
    展开全文
  • function J = deconvlucy(varargin)%DECONVLUCY Deblur image using Lucy-Richardson method.% J = DECONVLUCY(I,PSF) deconvolves image I using Lucy-% Richardson algorithm, returning deblurred image J....

    function J = deconvlucy(varargin)

    %DECONVLUCY Deblur image using Lucy-Richardson method.

    %   J = DECONVLUCY(I,PSF) deconvolves image I using Lucy-

    %   Richardson algorithm, returning deblurred image J. The assumption is

    %   that the image I was created by convolving a true image with a

    %   point-spread function PSF and possibly by adding noise.

    %

    %   I can be an N-Dimensional array.

    %

    %   To improve the restoration, additional parameters can be passed in

    %   (use [] as a place holder if an intermediate parameter is unknown):

    %   J = DECONVLUCY(I,PSF,NUMIT)

    %   J = DECONVLUCY(I,PSF,NUMIT,DAMPAR)

    %   J = DECONVLUCY(I,PSF,NUMIT,DAMPAR,WEIGHT)

    %   J = DECONVLUCY(I,PSF,NUMIT,DAMPAR,WEIGHT,READOUT)

    %   J = DECONVLUCY(I,PSF,NUMIT,DAMPAR,WEIGHT,READOUT,SUBSMPL), where

    %

    %   NUMIT   (optional) is the number of iterations (default is 10).

    %

    %   DAMPAR  (optional) is an array that specifies the threshold deviation

    %   of the resulting image from the image I (in terms of the standard

    %   deviation of Poisson noise) below which the damping occurs. The

    %   iterations are suppressed for the pixels that deviate within the

    %   DAMPAR value from their original value. This suppresses the noise

    %   generation in such pixels, preserving necessary image details

    %   elsewhere. Default is 0 (no damping).

    %

    %   WEIGHT  (optional) is assigned to each pixel to reflect its recording

    %   quality in the camera. A bad pixel is excluded from the solution by

    %   assigning it zero weight value. Instead of giving a weight of one for

    %   good pixels, you can adjust their weight according to the amount of

    %   flat-field correction. Default is a unit array of the same size as

    %   input image I.

    %

    %   READOUT (optional) is an array (or a value) corresponding to the

    %   additive noise (e.g., background, foreground noise) and the variance

    %   of the read-out camera noise. READOUT has to be in the units of the

    %   image. Default is 0.

    %

    %   SUBSMPL (optional) denotes subsampling and is used when the PSF is

    %   given on a grid that is SUBSMPL times finer than the image. Default

    %   is 1.

    %

    %   Note that the output image J could exhibit ringing introduced by the

    %   discrete Fourier transform used in the algorithm. To reduce the

    %   ringing use I = EDGETAPER(I,PSF) prior to calling DECONVLUCY.

    %

    %   Note also that DECONVLUCY allows you to resume deconvolution starting

    %   from the results of an earlier DECONVLUCY run. To initiate this

    %   syntax, the input image I has to be passed in as cell array, {I}.

    %   Then the output J becomes a cell array and can be passed as the input

    %   array into the next DECONVLUCY call. The input cell array can contain

    %   one numeric array (on initial call), or four numeric arrays (when it

    %   is the output from a previous run of DECONVLUCY). The output J

    %   contains four elements, where J{1}=I, J{2} is the image resulted from

    %   the last iteration, J{3} is the image from one before last iteration,

    %   J{4} is an array used internally by the iterative algorithm.

    %

    %   Class Support

    %   -------------

    %   I and PSF can be uint8, uint16, int16, double, or single. DAMPAR and

    %   READOUT must have the same class as the input image. Other inputs have to

    %   be double. The output image (or the first array of the output cell) has

    %   the same class as the input image.

    %

    %   Example

    %   -------

    %

    %      I = checkerboard(8);

    %      PSF = fspecial('gaussian',7,10);

    %      V = .0001;

    %      BlurredNoisy = imnoise(imfilter(I,PSF),'gaussian',0,V);

    %      WT = zeros(size(I));WT(5:end-4,5:end-4) = 1;

    %      J1 = deconvlucy(BlurredNoisy,PSF);

    %      J2 = deconvlucy(BlurredNoisy,PSF,20,sqrt(V));

    %      J3 = deconvlucy(BlurredNoisy,PSF,20,sqrt(V),WT);

    %      subplot(221);imshow(BlurredNoisy);

    %                     title('A = Blurred and Noisy');

    %      subplot(222);imshow(J1);

    %                     title('deconvlucy(A,PSF)');

    %      subplot(223);imshow(J2);

    %                     title('deconvlucy(A,PSF,NI,DP)');

    %      subplot(224);imshow(J3);

    %                     title('deconvlucy(A,PSF,NI,DP,WT)');

    %

    %   See also DECONVWNR, DECONVREG, DECONVBLIND, EDGETAPER, IMNOISE, PADARRAY,

    %            PSF2OTF, OTF2PSF.

    %   Copyright 1993-2005 The MathWorks, Inc.

    %   $Revision: 1.6.4.4 $

    %

    %   References

    %   ----------

    %   "Acceleration of iterative image restoration algorithms, by D.S.C. Biggs

    %   and M. Andrews, Applied Optics, Vol. 36, No. 8, 1997.

    %   "Deconvolutions of Hubble Space Telescope Images and Spectra",

    %   R.J. Hanisch, R.L. White, and R.L. Gilliland. in "Deconvolution of Images

    %   and Spectra", Ed. P.A. Jansson, 2nd ed., Academic Press, CA, 1997.

    % Parse inputs to verify valid function calling syntaxes and arguments

    [J,PSF,NUMIT,DAMPAR,READOUT,WEIGHT,SUBSMPL,sizeI,classI,numNSdim]=...

    parse_inputs(varargin{:});

    % 1. Prepare PSF. If PSF is known at a higher sampling rate, it has to be

    % padded with zeros up to sizeI(numNSdim)*SUBSMPL in all non-singleton

    % dimensions. Or its OTF could take care of it:

    sizeOTF = sizeI;

    sizeOTF(numNSdim) = SUBSMPL*sizeI(numNSdim);

    H = psf2otf(PSF,sizeOTF);

    % 2. Prepare parameters for iterations

    %

    % Create indexes for image according to the sampling rate

    idx = repmat({':'},[1 length(sizeI)]);

    for k = numNSdim,% index replicates for non-singleton PSF sizes only

    idx{k} = reshape(repmat(1:sizeI(k),[SUBSMPL 1]),[SUBSMPL*sizeI(k) 1]);

    end

    wI = max(WEIGHT.*(READOUT + J{1}),0);% at this point  - positivity constraint

    J{2} = J{2}(idx{:});

    scale = real(ifftn(conj(H).*fftn(WEIGHT(idx{:})))) + sqrt(eps);

    clear WEIGHT;

    DAMPAR22 = (DAMPAR.^2)/2;

    if SUBSMPL~=1,% prepare vector of dimensions to facilitate the reshaping

    % when the matrix is binned within the iterations.

    vec(2:2:2*length(sizeI)) = sizeI;

    vec(2*numNSdim-1) = -1;

    vec(vec==0) = [];

    num = fliplr(find(vec==-1));

    vec(num) = SUBSMPL;

    else

    vec = [];

    num = [];

    end

    % 3. L_R Iterations

    %

    lambda = 2*any(J{4}(:)~=0);

    for k = lambda + (1:NUMIT)

    % 3.a Make an image predictions for the next iteration

    if k > 2,

    lambda = (J{4}(:,1).'*J{4}(:,2))/(J{4}(:,2).'*J{4}(:,2) +eps);

    lambda = max(min(lambda,1),0);% stability enforcement

    end

    Y = max(J{2} + lambda*(J{2} - J{3}),0);% plus positivity constraint

    % 3.b  Make core for the LR estimation

    CC = corelucy(Y,H,DAMPAR22,wI,READOUT,SUBSMPL,idx,vec,num);

    % 3.c Determine next iteration image & apply positivity constraint

    J{3} = J{2};

    J{2} = max(Y.*real(ifftn(conj(H).*CC))./scale,0);

    clear CC;

    J{4} = [J{2}(:)-Y(:) J{4}(:,1)];

    end

    clear wI H scale Y;

    % 4. Convert the right array (for cell it is first array, for notcell it is

    % second array) to the original image class & output whole thing

    num = 1 + strcmp(classI{1},'notcell');

    if ~strcmp(classI{2},'double'),

    J{num} = changeclass(classI{2},J{num});

    end

    if num==2,% the input & output is NOT a cell

    J = J{2};

    end;

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %

    %  Function: parse_inputs

    function [J,PSF,NUMIT,DAMPAR,READOUT,WEIGHT,SUBSMPL,sizeI,classI,numNSdim] = ...

    parse_inputs(varargin)

    %

    % Outputs:

    % I=J{1}   the input array (could be any numeric class, 2D, 3D)

    % PSF      operator that distorts the ideal image

    % numNSdim non-singleton dimensions of PSF

    %

    % Defaults:

    %

    NUMIT = [];NUMIT_d = 10;% Number of  iterations, usually produces good

    % result by 10.

    DAMPAR =[];DAMPAR_d = 0;% No damping is default

    WEIGHT =[];WEIGHT_d = 1;% All pixels are of equal quality, flat-field is one

    READOUT=[];READOUT_d= 0;% Zero readout noise or any other

    % back/fore/ground noise associated with CCD camera.

    % Or the Image is corrected already for this noise by user.

    SUBSMPL= [];SUBSMPL_d= 1;% Image and PSF are given at equal resolution,

    % no over/under sampling at all.

    iptchecknargin(2,7,nargin,mfilename);

    % First, assign the inputs starting with the image

    %

    if iscell(varargin{1}),% input cell is used to resume interrupted iterations

    classI{1} = 'cell';% or interrupt the iteration to resume it later

    J = varargin{1};

    else % no-cell array is used to do a single set of iterations

    classI{1} = 'notcell';

    J{1} = varargin{1};% create a cell array in order to do the iterations

    end;

    % check the Image, which is the first array of the cell

    classI{2} = class(J{1});

    iptcheckinput(J{1},{'uint8' 'uint16' 'double' 'int16','single'},...

    {'real' 'nonempty' 'finite'},mfilename,'I',1);

    if length(J{1})<2,

    eid = sprintf('Images:%s:inputImagesMustHaveAtLeast2Elements',mfilename);

    msg = sprintf('In function %s, input image must have at least two elements in any one dimension.',...

    mfilename);

    error(eid,msg);

    elseif ~isa(J{1},'double'),

    J{1} = im2double(J{1});

    end

    % now since the image is OK&double, we assign the rest of the J cell

    len = length(J);

    if len == 1,% J = {I} will be reassigned to J = {I,I,0,0}

    J{2} = J{1};

    J{3} = 0;

    elseif len ~= 4,% J = {I,J,Jm1,gk} has to have 4 or 1 arrays

    eid = sprintf('Images:%s:inputCellMustHave1or4Elements',mfilename);

    error(eid,'The input cell I must consist of 1 or 4 numerical arrays.');

    else % check if J,Jm1,gk are double in the input cell

    if ~all([isa(J{2},'double'),isa(J{3},'double'),isa(J{4},'double')]),

    msg = sprintf(['In function %s, second, third, and forth array of the input image cell' ...

    ' have to be of class double.'],mfilename);

    eid = sprintf('Images:%s:inputImageCellElementsMustBeDouble',mfilename);

    error(eid,msg);

    end

    end;

    % Second, Assign the rest of the inputs:

    %

    PSF = varargin{2};%      deconvlucy(I,PSF)

    switch nargin

    case 3,%                 deconvlucy(I,PSF,NUMIT)

    NUMIT = varargin{3};

    case 4,%                 deconvlucy(I,PSF,NUMIT,DAMPAR)

    NUMIT = varargin{3};

    DAMPAR = varargin{4};

    case 5,%                 deconvlucy(I,PSF,NUMIT,DAMPAR,WEIGHT)

    NUMIT = varargin{3};

    DAMPAR = varargin{4};

    WEIGHT = varargin{5};

    case 6,%                 deconvlucy(I,PSF,NUMIT,DAMPAR,WEIGHT,READOUT)

    NUMIT = varargin{3};

    DAMPAR = varargin{4};

    WEIGHT = varargin{5};

    READOUT = varargin{6};

    case 7,%                 deconvlucy(I,PSF,NUMIT,DAMPAR,WEIGHT,READOUT,SUBSMPL)

    NUMIT = varargin{3};

    DAMPAR = varargin{4};

    WEIGHT = varargin{5};

    READOUT = varargin{6};

    SUBSMPL = varargin{7};

    end

    % Third, Check validity of the input parameters:

    %

    % NUMIT check number of iterations

    if isempty(NUMIT),

    NUMIT = NUMIT_d;

    else

    iptcheckinput(NUMIT,{'double'},{'scalar' 'positive' 'finite'},...

    mfilename,'NUMIT',3);

    end

    % SUBSMPL check sub-sampling rate

    if isempty(SUBSMPL),

    SUBSMPL = SUBSMPL_d;

    else

    iptcheckinput(SUBSMPL,{'double'},{'scalar' 'positive' 'finite'},...

    mfilename,'SUBSMPL',7);

    end

    % PSF array

    [sizeI, sizePSF] = padlength(size(J{1}), size(PSF));

    numNSdim = find(sizePSF~=1);

    if prod(sizePSF)<2,

    eid = sprintf('Images:%s:psfMustHaveAtLeast2Elements',mfilename);

    msg = sprintf('In function %s, PSF must have at least two elements.',mfilename);

    error(eid,msg);

    elseif all(PSF(:)==0),

    eid = sprintf('Images:%s:psfMustNotBeZeroEverywhere',mfilename);

    msg = sprintf('In function %s, PSF cannot be zero everywhere.',mfilename);

    error(eid,msg);

    elseif any(sizePSF(numNSdim)/SUBSMPL > sizeI(numNSdim)),

    eid = sprintf('Images:%s:psfMustBeSmallerThanImage',mfilename);

    msg = sprintf(['In function %s, size of the PSF must not exceed the image' ...

    ' size in any nonsingleton dimension.'], mfilename);

    error(eid,msg);

    end

    if length(J)==3,% assign the 4-th element of input cell now

    J{4}(prod(sizeI)*SUBSMPL^length(numNSdim),2) = 0;

    end;

    % DAMPAR check damping parameter

    if isempty(DAMPAR),

    DAMPAR = DAMPAR_d;

    elseif (numel(DAMPAR)~=1) && ~isequal(size(DAMPAR),sizeI),

    eid = sprintf('Images:%s:damparMustBeSameSizeAsImage',mfilename);

    msg = sprintf('In function %s, if not a scalar, DAMPAR has to be size of the input image.',...

    mfilename);

    error(eid,msg);

    elseif ~isa(DAMPAR,classI{2}),

    eid = sprintf('Images:%s:damparMustBeSameClassAsInputImage',mfilename);

    msg = sprintf('In function %s, DAMPAR has to be of the same class as the input image.',...

    mfilename);

    error(eid,msg);

    elseif ~strcmp(classI{2},'double'),

    DAMPAR = im2double(DAMPAR);

    end

    iptcheckinput(DAMPAR,{'double'},{'finite'},mfilename,'DAMPAR',4);

    % READOUT check read-out noise

    if isempty(READOUT),

    READOUT = READOUT_d;

    elseif (numel(READOUT)~=1) && ~isequal(size(READOUT),sizeI),

    eid = sprintf('Images:%s:readoutMustBeSameSizeAsImage',mfilename);

    msg = sprintf('In function %s, if not a scalar, READOUT has to be size of the input image.',...

    mfilename);

    error(eid,msg);

    elseif ~isa(READOUT,classI{2}),

    eid = sprintf('Images:%s:readoutMustBeSameClassAsInputImage',mfilename);

    msg = sprintf('In function %s, READOUT has to be of the same class as the input image.',...

    mfilename);

    error(eid,msg);

    elseif ~strcmp(classI{2},'double'),

    READOUT = im2double(READOUT);

    end

    iptcheckinput(READOUT,{'double'},{'finite'},mfilename,'READOUT',6);

    % WEIGHT check weighting

    if isempty(WEIGHT),

    WEIGHT = repmat(WEIGHT_d,sizeI);

    else

    iptcheckinput(WEIGHT,{'double'},{'finite'},mfilename,'WEIGHT',5);

    if (numel(WEIGHT)~=1) && ~isequal(size(WEIGHT),sizeI),

    eid = sprintf('Images:%s:weightMustBeSameSizeAsImage',mfilename);

    msg = sprintf('In function %s, if not a scalar, WEIGHT has to be size of the input image.',...

    mfilename);

    error(eid,msg);

    elseif numel(WEIGHT)== 1,

    WEIGHT = repmat(WEIGHT,sizeI);

    end

    end

    展开全文
  • Matlab:盲反卷积还原失焦图像

    万次阅读 多人点赞 2018-05-17 08:39:25
    Matlab:盲反卷积还原失焦图像 目录 输出结果 实现代码 输出结果 实现代码 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 盲反卷积还原失焦图像 % % % %%%%%%%%%%%%...

    Matlab:盲反卷积还原失焦图像

     

     

    目录

    输出结果

    实现代码


     

     

    输出结果

     

     

    实现代码

     

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %       盲反卷积还原失焦图像             %
    %                                       %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
    I = imread('G:\BaiduNetdiskDownload\5.jpg');
    I=rgb2gray(I)
    PSF=fspecial('gaussian',7,30);
    Blurred=imfilter(I,PSF,'symmetric','conv');  
    figure;imshow(Blurred);title('失焦图像');   
     
     
    UNDERPSF = ones(size(PSF)-4);
    [J1 P1] = deconvblind(Blurred,UNDERPSF);
    figure;imshow(J1);title('Deblurring with Undersized PSF'); 
       
    OVERPSF = padarray(UNDERPSF,[4  4],'replicate','both');
    [J2 P2] = deconvblind(Blurred,OVERPSF);
    figure;imshow(J2);title('Deblurring with Oversized PSF');     
    INITPSF = padarray(UNDERPSF,[2 2],'replicate','both');
    [J3 P3] = deconvblind(Blurred,INITPSF);
    figure;imshow(J3);title('Deblurring with INITPSF');  
       
    figure;
    subplot(221);imshow(P1,[],'InitialMagnification','fit');
    title('重建 Undersized PSF');
    subplot(222);imshow(P2,[],'InitialMagnification','fit');
    title('重建 Oversized PSF');
    subplot(223);imshow(P3,[],'InitialMagnification','fit');
    title('重建  init PSF');  
     
       
    WEIGHT = edge(I,'sobel',.3);  
    se = strel('disk',2);
    WEIGHT = 1-double(imdilate(WEIGHT,se));  
     
    WEIGHT([1:3 end-[0:2]],:) = 0;
    WEIGHT(:,[1:3 end-[0:2]]) = 0;
    figure;imshow(WEIGHT);title('Weight array'); 
    [J P] =                                  deconvblind(Blurred,INITPSF,30,[],WEIGHT);
    figure;imshow(J);title('复原图像');  
        
    P1 = 2;
    P2 = 2;
    FUN = @(PSF) padarray(PSF(P1+1:end-P1,P2+1:end-P2),[P1 P2]);  
    
    [JF PF] = deconvblind(Blurred,OVERPSF,30,[],WEIGHT,FUN);
    figure;imshow(JF);title('复原图像');   
    displayEndOfDemoMessage(mfilename) 
    展开全文
  • 利用MATLAB里的反卷积和反池化实现 王同学,想请你帮我思考一下做个东西:不知道你看过那个visualizing and understanding cnn那篇文章没有。你可以看到,他的可视化是通过上采样以及反卷积把某层的冲激响应映射会...
  • 彩色编码强度的matlab代码MATLAB中的颜色反卷积 背景 颜色反卷积由Ruifrok等人介绍。 在2001年[1]中描述了一种从组织学玻片的RGB图像中提取染色强度的方法。 颜色反卷积被广泛用于组织学中的图像处理,并且有非常...
  • 反卷积算法复原图像matlab实现,有着详细的注释和解释,可以让人很好读懂。
  • udeconv - 无监督 Wiener-Hunt 反卷积 xEap = udeconv(data, ir, ...) [xEap, gnChain, gxChain] = udeconv(data, ir, ...) 通过“ir”返回“data”的反卷积。 该算法是一个随机迭代过程(Gibbs 采样器),允许自动...
  • psf的matlab代码光场反卷积 标题:“用于光场显微镜的相空间反卷积”的Matlab代码本书作者:陆志(),吴佳敏,乔慧和游洲.etc 版本:1.0版权:2019,陆志,吴佳敏,乔乔,游洲,陶岩,周紫荆,张旭,范静涛,戴琼海...
  • Matlab软件包实现盲反卷积方法以从钙信号中恢复神经尖峰 要求 Matlab版本> = 2007 (用于大型稀疏重建的求解器)另请参见git(请注意,我们在NERDS项目中未包含SPGL1 ),因此请确保安装SPGL1并包含在MATLAB路径中。...
  • 4.首先运行getPSF.m,它将使用MATLAB的盲反卷积算法来生成PSF。 它还可以横向缩放堆栈,以加快计算速度。 5,它还以.mat格式存储不同的堆栈,以便可以通过不同的方法直接使用它们。 RL 确保您已运行getPSF.m 然后...
  • 在应用 od AR 滤波器后,信号通过最小熵反卷积。 这种组合的 AR+MED 方法带出了隐藏在噪声中的轴承故障。 该函数为单独的 AR 绘制两个图形,为 AR+MED 绘制另一个图形例子: 负载('s4.mat'); 信号=s4; Fs=12000...
  • 基于MATLAB并结合IBD算法的盲迭代反卷积法进行图像复原图像复原 盲迭代 反卷积 IBD PSF估计
  • matlab中存档算法代码盲反卷积反卷积是使用未知模糊内核对图像进行模糊处理的过程。 我的大部分工作都与Rob Fergus的相关工作及其实施有关 为了提取清晰的图像,我们首先需要计算模糊核。 后者是使用最大后验...
  • 该函数非常快速地将一个非常大的向量从另一个非常大的向量中解卷积。 速度的巨大提升是由于使用了两个 fft 和一个 ifft。 要了解如何使用此程序,请将其放在您的“工作”文件夹中并键入“help fdeconv”。
  • 与该论文相对应的注册和反卷积项目的代码集合: 郭敏等。 “。” 自然生物技术38.11(2020):1337-1346。 该存储库涵盖了本文报告的大多数功能和实现。 除深度学习模块DenseDeconNet之外的所有代码现在都可以在...
  • 在人类语音中,有两种方法可以构成我们的单词。 这些声音分为浊音和清音。 对于浊音部分,我们的喉咙就像一个传递函数。 元音包含在此类别中。 清音部分描述了语音中类似噪声的声音。 这些是用我们的嘴和舌头(而...
  • 内点法matlab代码OASIS:钙成像数据的在线快速反卷积 从荧光钙成像数据中提取神经活动的工具 该代码可以很容易地在神经时间荧光钙成像数据上运行。 请看一下。 要求 该脚本已在Linux和MacOS(一些用户也成功使用...
  • 反转换 YouTube视频“带反卷积的音频恶作剧”中使用的Matlab代码 YouTube连结: :
  • 静止状态HRF估计和反卷积的代码-Matlab(独立和SPM插件) 入门 有关静止状态HRF分析的分步说明,请参见。 请通过Docker了解Python独立版本和BIDS应用程序 教程 ./demo_codes/中提供了两个带有演示脚本的数据集,有关...
  • 盲解卷积是指在不确切了解卷积中使用的脉冲响应函数的情况下对信号进行解卷积。 这通常是通过对输入和/或脉冲响应添加适当的假设来恢复输出来实现的。 我们在这里考虑输入信号的稀疏性或简约性。 它通常用 l0 成本...
  • 用于自然图像反卷积MATLAB软件包 一般用途 您可以使用此源代码对自然模糊的图像进行反卷积 示范范例 ---原始图像--------去模糊--- 要求 MATLAB R2015b(最低) 应该安装 MATLAB代码 演示功能: demo_image_...
  • Lsqnonlin代码用于MS2数据的反卷积,多指数回归和模型推断包 版本:2021年4月 蒙彼利埃大学(University of Montpellier)的奥维迪乌·拉杜列斯库(Ovidiu Radulescu)撰写版权:本出版物以3节BSD发表 该软件包包含...
  • GPU使用CUDA加速了3D图像反卷积。 由Lin Shao和Dan Milkie在Janelia的Betzig实验室开发。 笔记 在此“ C:\ cudaDecon \ CMakeLists.txt”中指定了兼容的GPU。 这也设置了所有到依赖库的链接。 如果最终添加其他代码...
  • Hill代码钙成像反卷积方法列表 这是已发布的钙成像反卷积方法的集合,并链接到它们的代码。 用于基本性能测试的每个代码的修订版都在列表中标记为修订版。 主要目标 我们使用同时​​进行的Ephys成像数据(参见下文...
  • 目录bash符号卷积code备注blog符号变换Fourier变换及其变换fourier()是算符号表达式的傅里叶变换的,算出来结果要画图能够用ezplot();it【例 1】求 的 Fourier 变换。class matlab 代码:变量% 傅里叶变换syms t ...

空空如也

空空如也

1 2 3 4 5 ... 12
收藏数 233
精华内容 93
关键字:

matlab反卷积

matlab 订阅