compdiff3.m

来自「各项异性扩散的图象处理代码.希望你能丛中有所领悟.」· M 代码 · 共 45 行

M
45
字号
%Program : Non Linear Complex Diffusion%Author : Jeny Rajan%The following program will produce scale space image based on the concept of %non linear complex diffusion.%Application area : Image Denoising.%Ref : Guy Gilboa, Nir Sochen and Yehoshua Y Zeevi, "Image Enhancement and Denoising by Complex Diffusion Processes", %IEEE Trans. On Pattern Analysis and Machine Imtelligence, Vol. 26, No. 8, Aug. 2004% *************************************************% * method :  It=del(c(Im(I)del I)                *% *           c(Im(I)) =         e^i*theta        *% *                      ----------------------   *% *                      1+ [Im(I)/(k*theta)]^2   *% *************************************************% Usage% compdiff1(I,T)% I - Input image, in case of denoising, noisy image% T - Threshold, an integer >= 1function [ncdif] = compdiff3(I,T)I = double(I);[x y z]=size(I);im=imag(I);theta=3*3.14/30;dt = 0.1;It1  = I;     It2 = I;        k=1.5;t=1;for t=1:T  [Ix, Iy] = gradient(It1);    tmp1=cos(theta)+sqrt(-1)*sin(theta);  tmp2=(imag(It1)./(k*theta)).^2;  g=tmp1./(1+tmp2);  [div1, div2] = gradient( g .* Ix);  [div3, div4] = gradient( g .* Iy);  div = div1 + div4;      It2 = It1 + dt .* div;  It1 = It2;end;im1=uint8(real(It1)); im2=uint8(imag(It1));figure,imshow(im1,[]);figure,imshow(im2,[]);ncdif = uint8(real(It1));   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?