MATLAB课设代做在哪儿找,MATLAB代做|FPGA代做–Tikhonov算法的仿真

MATLAB课设代做在哪儿找,MATLAB代做|FPGA代做–Tikhonov算法的仿真资源简介:MATLAB程序下载——一基于MATLAB的Tikhonov算法的仿真。function[u,SNR]=tik_inpaint(I,u0,mask)%AlgorithmfortheTikhonovmodelofimageinpainting,usingaleast%squaresapproach(asopposedtoiterativeappro…

MATLAB课设代做在哪儿找,MATLAB代做|FPGA代做--Tikhonov算法的仿真

资源简介:

MATLAB程序下载——一基于MATLAB的Tikhonov算法的仿真。

function [u,SNR] = tik_inpaint(I,u0,mask)

% Algorithm for the Tikhonov model of image inpainting, using a least

% squares approach (as opposed to iterative approach)

%

% Input: I = original clean image

%        u0 = corrupted image

%        mask = set of data without missing intensities

%

% Output: u = TV restored image

%         SNR = signal-to-noise ratio

% initialization

[n,m]=size(u0);

u0=u0(:);

nm=n*m;

u0(mask == 1) = NaN;

k=isnan(u0(:));

% list the nodes which are known, and which will be interpolated

notinD = find(k);

inD = find(~k);

[nr,nc]=ind2sub([n,m],notinD);

notinD=[notinD,nr,nc];

% build sparse matrix approximating Laplacian for every element in u0.

% compute finite difference for second partials on row variable

[i,j]=ndgrid(2:(n-1),1:m);

indices=i(:)+(j(:)-1)*n;

laplacian=sparse(repmat(indices,1,3),[indices-1,indices,indices+1], …

repmat([1 -2 1],(n-2)*m,1),n*m,n*m);

% now second partials on column variable

[i,j] = ndgrid(1:n,2:(m-1));

indices   = i(:)+(j(:)-1)*n;

laplacian=laplacian+sparse(repmat(indices,1,3),[indices-n,indices,indices+n], …

repmat([1 -2 1],n*(m-2),1),nm,nm);

% eliminate knowns

rhs=-laplacian(:,inD)*u0(inD);

k=find(any(laplacian(:,notinD),2));

% and solve…

u=u0;

u(notinD(:,1))=laplacian(k,notinD(:,1))\rhs(k);

u=reshape(u,n,m);

% calculate SNR

num = var(I(:), 1);

denom = mean((I(:)-u(:)).^2);

SNR = 10*log10(num/denom);

下载:

今天的文章MATLAB课设代做在哪儿找,MATLAB代做|FPGA代做–Tikhonov算法的仿真分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/32555.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注