SlideShare a Scribd company logo
1 of 2
clear all;
close all;
clc;
% Filter Parameters.
sigmas=1.8; %%% Spatial (Geometric) Sigma.
mult_factor_sigmar=5; %%% Multiplication factor for SigmaR.
ksize=11; %%% Kernal Size.
%%% Wavelet Transform Parameters.
Nlevels=3; %% 3 levels.
NoOfBands=3*Nlevels+1;
wname='db8'; % data binary =8 bit
sorh='s'; % crop
x = imread('boat.png');
if(size(x,3)==3)
x=rgb2gray(x);
figure
imshow(x)
end
[M,N]=size(x);
mean_val=0;
Square_scaled_para=15
%Square_scaled_para=Square_scaled_para/10;
%for Square_scaled_para = 1:numel(Square_scaled_para) % for loop range= 1 to
length of
sizeA = size(x);
xn= imnoise(x,'speckle',0.01);
%%
figure
imshow(xn) % noisy image
title('noisy image')
xn = max(0,min(xn,255));
xn_mse=sum(sum((double(x)-double(xn)).^2))/(M*N);
xn_psnr=(10*log10(255^2./xn_mse))/3
tic
%%% Noise Level Estimation using Robust Median Estimator.
[ca,ch,cv,cd]=dwt2(xn,wname);
tt1=cd(:)';
median_hh2=median(abs(tt1));
std_dev2=(median_hh2/0.6745);
sigmar=mult_factor_sigmar*std_dev2;
[yb yg]= Linear_filt2D(xn,sigmas,sigmar,ksize);
yd=double(xn)-yb;
%%% General Wavelet Decomposition.
dwtmode('per');
[C,S]=wavedec2(yd,Nlevels,wname);
k=NoOfBands;
CW{k}=reshape(C(1:S(1,1)*S(1,2)),S(1,1),S(1,2));
k=k-1;
st_pt=S(1,1)*S(1,2);
for i=2:size(S,1)-1
slen=S(i,1)*S(i,2);
CW{k}=reshape(C(st_pt+slen+1:st_pt+2*slen),S(i,1),S(i,2));
CW{k-1}=reshape(C(st_pt+1:st_pt+slen),S(i,1),S(i,2));
CW{k-2}=reshape(C(st_pt+2*slen+1:st_pt+3*slen),S(i,1),S(i,2));
st_pt=st_pt+3*slen;
k=k-3;
end
tt2=CW{1}(:)';
median_hh2=median(abs(tt2)); %% HH1->Subband containing finest level diagonal
details.
std_dev2=(median_hh2/0.6745);
cw_noise_var=std_dev2^2; %% var=std^2
for i=1:NoOfBands-1
thr=bayesthf(CW{i},cw_noise_var);
yw{i}=threshf(CW{i},sorh,thr,2);
end
yw{i+1}=CW{i+1};
if(isequal(wname,'DCHWT'))
ydr=dchwtf2(yw,-Nlevels);
else
k=NoOfBands;
xrtemp=reshape(yw{k},1,S(1,1)*S(1,2));
k=k-1;
for i=2:size(S,1)-1
xrtemp=[xrtemp reshape(yw{k-1},1,S(i,1)*S(i,2))
reshape(yw{k},1,S(i,1)*S(i,2)) reshape(yw{k-2},1,S(i,1)*S(i,2))];
k=k-3;
end
ydr=(waverec2(xrtemp,S,wname));
end
%[y,map] = bin2gray(x,'qam',16);
ybw=yb+ydr;
ybwn=uint8(ybw);
yb1=yb;
yb=uint8(yb);
figure
imshow(yb) % reconstructed image
title(' reconstructed image')
toc
%%%% MSE Computation.
yb_mse=sum(sum((double(x)-double(yb)).^2))/(M*N);
ybw_mse=sum(sum((double(x)-double(ybwn)).^2))/(M*N);
%%%% PSNR Computation.
psnr_lfilt=10*log10(255^2./yb_mse);
psnr_lf_mnt=10*log10(255^2./ybw_mse);
mean_org=mean(x(:));
var_org=sum((x(:)-mean_org).^2)/(M*N-1);
mean_lfilt=mean(yb(:));
var_lfilt=sum((yb(:)-mean_lfilt).^2)/(M*N-1);
cross_var_lfilt=sum((x(:)-mean_org).*(yb(:)-mean_lfilt))/(M*N-1);
IQI_lfilt=(4*cross_var_lfilt*mean_org*mean_lfilt)/
((var_org+var_lfilt)*(mean_org^2+mean_lfilt^2));
mean_bwt=mean(ybwn(:));
var_bwt=sum((ybwn(:)-mean_bwt).^2)/(M*N-1);
cross_var_bwt=sum((x(:)-mean_org).*(ybwn(:)-mean_bwt))/(M*N-1);
IQI_bf_mnt=(4*cross_var_bwt*mean_org*mean_bwt)/
((var_org+var_bwt)*(mean_org^2+mean_bwt^2));
mse=sum(sum((double(x)-double(ybw)).^2))/(M*N);
psnr_linear=10*log10(255^2./mse)
figure
plot(Square_scaled_para,xn_psnr,'k-*')
xlabel('SQUIRED SCALE PARAMETER');
ylabel('PSNR (dB)');
hold on;
plot(Square_scaled_para,psnr_linear,'r','marker','*')
hold on;
legend('No Filter','Proposed','Location','Best');

More Related Content

Viewers also liked

Viewers also liked (10)

Absensi
AbsensiAbsensi
Absensi
 
kupon Remaja
kupon Remajakupon Remaja
kupon Remaja
 
Degree
DegreeDegree
Degree
 
Tennessee National Round 4
Tennessee National Round 4Tennessee National Round 4
Tennessee National Round 4
 
Absensi sdn jugo 1 3
Absensi sdn jugo 1   3Absensi sdn jugo 1   3
Absensi sdn jugo 1 3
 
Certificado - Denis
Certificado - DenisCertificado - Denis
Certificado - Denis
 
Noorun Alaa Noor
Noorun Alaa NoorNoorun Alaa Noor
Noorun Alaa Noor
 
Behaloscha 1
Behaloscha 1Behaloscha 1
Behaloscha 1
 
Tablas
TablasTablas
Tablas
 
Sangrías
SangríasSangrías
Sangrías
 

Similar to Image denoising using wavelet thresholding

Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfaartechindia
 
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfI need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfeyewatchsystems
 
Sequential radar tracking
Sequential radar trackingSequential radar tracking
Sequential radar trackingAssignmentpedia
 
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfConsider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfmeerobertsonheyde608
 
Bicubic interpolation codes
Bicubic interpolation codesBicubic interpolation codes
Bicubic interpolation codesmmjalbiaty
 
Drill bit optimization code
Drill bit optimization codeDrill bit optimization code
Drill bit optimization codeANKIT KUKREJA
 
Scientific Computing II Numerical Tools & Algorithms - CEI40 - AGA
Scientific Computing II Numerical Tools & Algorithms - CEI40 - AGAScientific Computing II Numerical Tools & Algorithms - CEI40 - AGA
Scientific Computing II Numerical Tools & Algorithms - CEI40 - AGAAhmed Gamal Abdel Gawad
 
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876NgGiaHi
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876NgGiaHi
 
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdffunction [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdfsinghanubhav1234
 
Dct compressionfactor8.doc
Dct compressionfactor8.docDct compressionfactor8.doc
Dct compressionfactor8.docMITTU1
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical ComputingNaveed Rehman
 
gptips1.0concrete.matConcrete_Data[1030x9 double array]tr.docx
gptips1.0concrete.matConcrete_Data[1030x9  double array]tr.docxgptips1.0concrete.matConcrete_Data[1030x9  double array]tr.docx
gptips1.0concrete.matConcrete_Data[1030x9 double array]tr.docxwhittemorelucilla
 
Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağıMerve Cvdr
 
Machine hw3
Machine hw3Machine hw3
Machine hw3Yi Cui
 
R/Finance 2009 Chicago
R/Finance 2009 ChicagoR/Finance 2009 Chicago
R/Finance 2009 Chicagogyollin
 

Similar to Image denoising using wavelet thresholding (20)

Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
 
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfI need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
 
Sequential radar tracking
Sequential radar trackingSequential radar tracking
Sequential radar tracking
 
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfConsider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
 
Bicubic interpolation codes
Bicubic interpolation codesBicubic interpolation codes
Bicubic interpolation codes
 
Drill bit optimization code
Drill bit optimization codeDrill bit optimization code
Drill bit optimization code
 
Scientific Computing II Numerical Tools & Algorithms - CEI40 - AGA
Scientific Computing II Numerical Tools & Algorithms - CEI40 - AGAScientific Computing II Numerical Tools & Algorithms - CEI40 - AGA
Scientific Computing II Numerical Tools & Algorithms - CEI40 - AGA
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876
 
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdffunction [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf
 
Dct compressionfactor8.doc
Dct compressionfactor8.docDct compressionfactor8.doc
Dct compressionfactor8.doc
 
Survey Demo
Survey DemoSurvey Demo
Survey Demo
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
gptips1.0concrete.matConcrete_Data[1030x9 double array]tr.docx
gptips1.0concrete.matConcrete_Data[1030x9  double array]tr.docxgptips1.0concrete.matConcrete_Data[1030x9  double array]tr.docx
gptips1.0concrete.matConcrete_Data[1030x9 double array]tr.docx
 
Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağı
 
3.pdf
3.pdf3.pdf
3.pdf
 
Machine hw3
Machine hw3Machine hw3
Machine hw3
 
CODING
CODINGCODING
CODING
 
R/Finance 2009 Chicago
R/Finance 2009 ChicagoR/Finance 2009 Chicago
R/Finance 2009 Chicago
 

More from Punit Karnani

Mammogram image enhancement techniques for detecting breast cancer
Mammogram image enhancement techniques for detecting breast cancerMammogram image enhancement techniques for detecting breast cancer
Mammogram image enhancement techniques for detecting breast cancerPunit Karnani
 
research paper Ijetae 0812 23
research paper Ijetae 0812 23research paper Ijetae 0812 23
research paper Ijetae 0812 23Punit Karnani
 
Enahncement method to detect breast cancer
Enahncement method to detect breast cancerEnahncement method to detect breast cancer
Enahncement method to detect breast cancerPunit Karnani
 
A survey on enhancing mammogram image saradha arumugam academia
A survey on enhancing mammogram image   saradha arumugam   academiaA survey on enhancing mammogram image   saradha arumugam   academia
A survey on enhancing mammogram image saradha arumugam academiaPunit Karnani
 

More from Punit Karnani (8)

Youtuobelink
YoutuobelinkYoutuobelink
Youtuobelink
 
Presentation1 major
Presentation1 majorPresentation1 major
Presentation1 major
 
Mass segmentation
Mass segmentationMass segmentation
Mass segmentation
 
Mammogram image enhancement techniques for detecting breast cancer
Mammogram image enhancement techniques for detecting breast cancerMammogram image enhancement techniques for detecting breast cancer
Mammogram image enhancement techniques for detecting breast cancer
 
research paper Ijetae 0812 23
research paper Ijetae 0812 23research paper Ijetae 0812 23
research paper Ijetae 0812 23
 
Enahncement method to detect breast cancer
Enahncement method to detect breast cancerEnahncement method to detect breast cancer
Enahncement method to detect breast cancer
 
7103
71037103
7103
 
A survey on enhancing mammogram image saradha arumugam academia
A survey on enhancing mammogram image   saradha arumugam   academiaA survey on enhancing mammogram image   saradha arumugam   academia
A survey on enhancing mammogram image saradha arumugam academia
 

Recently uploaded

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Recently uploaded (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

Image denoising using wavelet thresholding

  • 1. clear all; close all; clc; % Filter Parameters. sigmas=1.8; %%% Spatial (Geometric) Sigma. mult_factor_sigmar=5; %%% Multiplication factor for SigmaR. ksize=11; %%% Kernal Size. %%% Wavelet Transform Parameters. Nlevels=3; %% 3 levels. NoOfBands=3*Nlevels+1; wname='db8'; % data binary =8 bit sorh='s'; % crop x = imread('boat.png'); if(size(x,3)==3) x=rgb2gray(x); figure imshow(x) end [M,N]=size(x); mean_val=0; Square_scaled_para=15 %Square_scaled_para=Square_scaled_para/10; %for Square_scaled_para = 1:numel(Square_scaled_para) % for loop range= 1 to length of sizeA = size(x); xn= imnoise(x,'speckle',0.01); %% figure imshow(xn) % noisy image title('noisy image') xn = max(0,min(xn,255)); xn_mse=sum(sum((double(x)-double(xn)).^2))/(M*N); xn_psnr=(10*log10(255^2./xn_mse))/3 tic %%% Noise Level Estimation using Robust Median Estimator. [ca,ch,cv,cd]=dwt2(xn,wname); tt1=cd(:)'; median_hh2=median(abs(tt1)); std_dev2=(median_hh2/0.6745); sigmar=mult_factor_sigmar*std_dev2; [yb yg]= Linear_filt2D(xn,sigmas,sigmar,ksize); yd=double(xn)-yb; %%% General Wavelet Decomposition. dwtmode('per'); [C,S]=wavedec2(yd,Nlevels,wname); k=NoOfBands; CW{k}=reshape(C(1:S(1,1)*S(1,2)),S(1,1),S(1,2)); k=k-1; st_pt=S(1,1)*S(1,2); for i=2:size(S,1)-1 slen=S(i,1)*S(i,2); CW{k}=reshape(C(st_pt+slen+1:st_pt+2*slen),S(i,1),S(i,2)); CW{k-1}=reshape(C(st_pt+1:st_pt+slen),S(i,1),S(i,2)); CW{k-2}=reshape(C(st_pt+2*slen+1:st_pt+3*slen),S(i,1),S(i,2)); st_pt=st_pt+3*slen; k=k-3; end tt2=CW{1}(:)'; median_hh2=median(abs(tt2)); %% HH1->Subband containing finest level diagonal details. std_dev2=(median_hh2/0.6745);
  • 2. cw_noise_var=std_dev2^2; %% var=std^2 for i=1:NoOfBands-1 thr=bayesthf(CW{i},cw_noise_var); yw{i}=threshf(CW{i},sorh,thr,2); end yw{i+1}=CW{i+1}; if(isequal(wname,'DCHWT')) ydr=dchwtf2(yw,-Nlevels); else k=NoOfBands; xrtemp=reshape(yw{k},1,S(1,1)*S(1,2)); k=k-1; for i=2:size(S,1)-1 xrtemp=[xrtemp reshape(yw{k-1},1,S(i,1)*S(i,2)) reshape(yw{k},1,S(i,1)*S(i,2)) reshape(yw{k-2},1,S(i,1)*S(i,2))]; k=k-3; end ydr=(waverec2(xrtemp,S,wname)); end %[y,map] = bin2gray(x,'qam',16); ybw=yb+ydr; ybwn=uint8(ybw); yb1=yb; yb=uint8(yb); figure imshow(yb) % reconstructed image title(' reconstructed image') toc %%%% MSE Computation. yb_mse=sum(sum((double(x)-double(yb)).^2))/(M*N); ybw_mse=sum(sum((double(x)-double(ybwn)).^2))/(M*N); %%%% PSNR Computation. psnr_lfilt=10*log10(255^2./yb_mse); psnr_lf_mnt=10*log10(255^2./ybw_mse); mean_org=mean(x(:)); var_org=sum((x(:)-mean_org).^2)/(M*N-1); mean_lfilt=mean(yb(:)); var_lfilt=sum((yb(:)-mean_lfilt).^2)/(M*N-1); cross_var_lfilt=sum((x(:)-mean_org).*(yb(:)-mean_lfilt))/(M*N-1); IQI_lfilt=(4*cross_var_lfilt*mean_org*mean_lfilt)/ ((var_org+var_lfilt)*(mean_org^2+mean_lfilt^2)); mean_bwt=mean(ybwn(:)); var_bwt=sum((ybwn(:)-mean_bwt).^2)/(M*N-1); cross_var_bwt=sum((x(:)-mean_org).*(ybwn(:)-mean_bwt))/(M*N-1); IQI_bf_mnt=(4*cross_var_bwt*mean_org*mean_bwt)/ ((var_org+var_bwt)*(mean_org^2+mean_bwt^2)); mse=sum(sum((double(x)-double(ybw)).^2))/(M*N); psnr_linear=10*log10(255^2./mse) figure plot(Square_scaled_para,xn_psnr,'k-*') xlabel('SQUIRED SCALE PARAMETER'); ylabel('PSNR (dB)'); hold on; plot(Square_scaled_para,psnr_linear,'r','marker','*') hold on; legend('No Filter','Proposed','Location','Best');