Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Main.m
Package: Diffusion.zip [view]
Upload User: zcsybk2
Upload Date: 2022-02-09
Package Size: 1k
Code Size: 2k
Category:
2D Graphic
Development Platform:
Matlab
- im1 = imread('1.jpg'); % input image
- choice = input('Choise= '); % 1=PM exponential method, 2= other PM method, 3=isotropic Diffusion
- itr = input('Iteration= '); % number of iteration
- z=input('z= '); % isotropic coefficient
- im1 = double(im1);
- im = im1;
- N = [0 1 0; 0 -1 0; 0 0 0];
- S = [0 0 0; 0 -1 0; 0 1 0];
- E = [0 0 0; 0 -1 1; 0 0 0];
- W = [0 0 0; 1 -1 0; 0 0 0];
- NE = [0 0 1; 0 -1 0; 0 0 0];
- SE = [0 0 0; 0 -1 0; 0 0 1];
- SW = [0 0 0; 0 -1 0; 1 0 0];
- NW = [1 0 0; 0 -1 0; 0 0 0];
- for t = 1:itr
- delN = conv2(im,N,'same');
- delS = conv2(im,S,'same');
- delW = conv2(im,W,'same');
- delE = conv2(im,E,'same');
- delNE = conv2(im,NE,'same');
- delSE = conv2(im,SE,'same');
- delSW = conv2(im,SW,'same');
- delNW = conv2(im,NW,'same');
- if choice == 1
- S_N = exp(-(delN/k).^2);
- S_S = exp(-(delS/k).^2);
- S_W = exp(-(delW/k).^2);
- S_E = exp(-(delE/k).^2);
- S_NE = exp(-(delNE/k).^2);
- S_SE = exp(-(delSE/k).^2);
- S_SW = exp(-(delW/k).^2);
- S_NW = exp(-(delNW/k).^2);
- elseif choice == 2
- S_N = 1./(1 + (delN/k).^2);
- S_S = 1./(1 + (delS/k).^2);
- S_W = 1./(1 + (delW/k).^2);
- S_E = 1./(1 + (delE/k).^2);
- S_NE = 1./(1 + (delNE/k).^2);
- S_SE = 1./(1 + (delSE/k).^2);
- S_SW = 1./(1 + (delSW/k).^2);
- S_NW = 1./(1 + (delNW/k).^2);
- elseif choice == 3
- S_N = z;
- S_S = z;
- S_W = z;
- S_E = z;
- S_NE =z;
- S_SE =z;
- S_SW =z;
- S_NW =z;
- end
- dx = 1;
- dy = 1;
- dxy = sqrt(2);
- delta = 1/7;
- im = im + delta*((1/(dy^2))*S_N.*delN + (1/(dy^2))*S_S.*delS + ...
- (1/(dx^2))*S_W.*delW + (1/(dx^2))*S_E.*delE + ...
- (1/(dxy^2))*S_NE.*delNE + (1/(dxy^2))*S_SE.*delSE + ...
- (1/(dxy^2))*S_SW.*delSW + (1/(dxy^2))*S_NW.*delNW );
- end
- clc;
- figure, subplot 211, imshow(im1,[]),title('Original Image'), subplot 212, imshow(im,[]); title('Diffused Image')