【图像处理】基于matlab全变差图像处理【含Matlab源码 457期】
2021/6/28 20:50:39
本文主要是介绍【图像处理】基于matlab全变差图像处理【含Matlab源码 457期】,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、简介
二、源代码
function compareimages(A,ATitle,B,BTitle) %COMPAREIMAGES Displays two images side by side with linked axes % COMPAREIMAGES(A,B) displays images A and B, where A and B are either % grayscale or RGB color images with values in [0,1]. The images are % displayed with linked axes for convenient panning and zooming. % % COMPAREIMAGES(A,'A title',B,'B title') specifies titles above the % images. % % See also linkaxes. % Pascal Getreuer 2009 if nargin == 2 B = ATitle; ATitle = ''; BTitle = ''; elseif nargin < 4 error('Must have 2 or 4 input arguments.'); end ax(1) = subplot(1,2,1); hold off if ndims(A) == 2 image(A*255); colormap(gray(256)); elseif ndims(A) == 3 image(min(max(A,0),1)); end set(gca,'Units','Normalized','Position',[0,0.1,0.5,0.8]); axis image axis off title(ATitle); zoom; ax(2) = subplot(1,2,2); hold off if ndims(B) == 2 image(B*255); colormap(gray(256)); elseif ndims(B) == 3 image(min(max(B,0),1)); end set(gca,'Units','Normalized','Position',[0.5,0.1,0.5,0.8]); axis image axis off title(BTitle); %%% Demo of image deconvolution %%% BlurRadius = 3; NoiseLevel = 0.005; lambda = 4e3; uexact = double(imread('einstein.png'))/255; % Construct the blur filter [x,y] = meshgrid(1:size(uexact,2),1:size(uexact,1)); psf = double((x-size(uexact,2)/2).^2 ... + (y-size(uexact,1)/2).^2 <= BlurRadius^2); psf = psf/sum(psf(:)); % Simulate a noisy and blurry image f = real(ifft2(fft2(uexact).*fft2(fftshift(psf)))); f = f + randn(size(uexact))*NoiseLevel; % Deblur u = tvdeconv(f,lambda,psf);unction u = tvdenoise(f,lambda,varargin) %TVDENOISE Total variation image denoising. % u = TVDENOISE(f,lambda,model) denoises grayscale, color, or arbitrary % multichannel image f using total variation regularization. Parameter % lambda controls the strength of the noise reduction: smaller lambda % implies stronger denoising. % % The model parameter specifies the noise model (case insensitive): % 'Gaussian' or 'L2' - (default) The degradation model for additive % white Gaussian noise (AWGN), % f = (exact) + (Gaussian noise). % 'Laplacian' or 'L1' - The degradation model assumes impulsive noise, % for example, salt & pepper noise. % 'Poisson' - Each pixel is an independent Poisson random % variable with mean equal to the exact value. % % TVDENOISE(...,Tol,MaxIter) specify the stopping tolerance and the % maximum number of iterations. % % See also tvdeconv, tvinpaint, and tvrestore.
三、运行结果
四、备注
版本:2014a
完整代码或代写加QQ1564658423
这篇关于【图像处理】基于matlab全变差图像处理【含Matlab源码 457期】的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-19《2023版Java工程师》课程升级公告
- 2024-06-15matplotlib作图不显示3D图,怎么办?
- 2024-06-1503-Loki 日志监控
- 2024-06-1504-让LLM理解知识 -Prompt
- 2024-06-05做软件测试需要懂代码吗?
- 2024-06-0514-ShardingSphere的分布式主键实现
- 2024-06-03为什么以及如何要进行架构设计权衡?
- 2024-05-31全网首发第二弹!软考2024年5月《软件设计师》真题+解析+答案!(11-20题)
- 2024-05-31全网首发!软考2024年5月《软件设计师》真题+解析+答案!(21-30题)
- 2024-05-30【Java】百万数据excel导出功能如何实现