SlideShare una empresa de Scribd logo
1 de 14
Penn State University
E E 458 Project 3
Using Adaptive Filters to Remove Gaussian Noise
By Chad RyanWeiss
4/6/2016
Abstract:
Adaptive filteringisapopulardigital image processingtechniquethatusesstatistical datafroman image
to alterthe contentsof that image. The type of filterusedinthisreportwill take the variance andmean
of the image andapplyit ina way that will hopefullyreduce the amountof Gaussiannoise presentinthe
image. The firstpart of thisreportwill gointothe theorybehindadaptive filtering. Thenwe will apply
thistheoryand create a MatLab computerprogramthat will remove unwantednoise fromanimage in
the secondpart of thisreport.
Theory: Adaptive Filtering
Adaptive filtersuse dynamicvariablesasinputstoacquire a desiredoutput.
Application: RemovingGaussianNoise
% Name: Chad Weiss
% Date: March 25, 2016
% Project: E E 458 Project 003
% Instructor: Dr. Aldo Morales
% This program implements an adaptive filtering technique that uses the
% statistical means and variances of the image to reduce gaussian noise.
clear all;clc;
% Read-In Image
I = imread('Neighbors.jpg'); Status = imfinfo('Neighbors.jpg');
% Add Noise to Image
noise_variance = 0.03;
J = imnoise(I,'gaussian',0,noise_variance);
% Zero Border
Input = [zeros(1,Status.Width,3);J;zeros(1,Status.Width,3)];
Input = [zeros(Status.Height+2,1,3),Input,zeros(Status.Height+2,1,3)];
imtool(Input);
% Noisy r,g and b planes (RGB format)
r = Input; r(:,:,2:3)=0;
g = Input; g(:,:,1)=0; g(:,:,3)=0;
b = Input; b(:,:,1:2)=0;
R = double(r(:,:,1))/256;
G = double(g(:,:,2))/256;
B = double(b(:,:,3))/256;
% Define the Filter Mask
mask = zeros(3,3);
% Define Output Image
Output_R = zeros(Status.Height+2, Status.Width+2);
Output_G = zeros(Status.Height+2, Status.Width+2);
Output_B = zeros(Status.Height+2, Status.Width+2);
% Red Value Plane Loop
for i = 1:Status.Height
for j = 1:Status.Width
mask = R(i:i+2,j:j+2);
M = mean(reshape(mask,[],1)); % Mean
V = var(reshape(mask,[],1));
output = (mask(5)-((noise_variance/V)*(mask(5)-M))); % Output
if output < 0
output = 0;
end
if output > 1
output = 1;
end
Output_R(i+1,j+1) = output; % Insert Output
end
end
% Green Value Plane Loop
for i = 1:Status.Height
for j = 1:Status.Width
mask = G(i:i+2,j:j+2);
M = mean(reshape(mask,[],1));
V = var(reshape(mask,[],1));
output = (mask(5)-((noise_variance/V)*(mask(5)-M)));
if output < 0
output = 0;
end
if output > 1
output = 1;
end
Output_G(i+1,j+1) = output;
end
end
% Blue Value Plane Loop
for i = 1:Status.Height
for j = 1:Status.Width
mask = B(i:i+2,j:j+2);
M = mean(reshape(mask,[],1));
V = var(reshape(mask,[],1));
output = (mask(5)-((noise_variance/V)*(mask(5)-M)));
if output < 0
output = 0;
end
if output > 1
output = 1;
end
Output_B(i+1,j+1) = output;
end
end
Output = uint8(cat(3,Output_R*256,Output_G*256,Output_B*256));
imtool(Output);
Figure 1: Noisy Input
Figure 2: Adaptive Filter Output
Analysis:
The code breaksdownlike so:
1. Read-Inthe Image
2. AddNoise tothe Image
3. Create a ZeroBorder aroundthe perimeterof the image
4. Isolate the Red, Green andBlue Planes
5. Convertto type single ordouble
6. Define the 3-by-3mask
7. Fill the maskwiththe noisyimage values
8. Determine the variance andmeanof the mask
9. Applythe formula(highlightedinyellow)
10. Setthe centervalue of the maskequal tothe outputof the formulaand applytoa similarsize
zeromatrix
11. Repeatforthe Greenand Blue Planes
12. Concatenate the three planestoformthe final output
13. Displaythe InputandOutputimagesforcomparison
Discussion:
It was difficulttogetthisfiltertoproduce a clearoutputdespite severaldifferentapproaches. First,we
triedconvertingRGN to HSV formatbut foundoutthat thistype of filterdidnotworkat all on the Hue
and Saturationplanesof the images;furthermore,itproducedaveryinconsistentsmearingof the
Gaussiannoise acrossthe V planesof the HSV images. The secondattemptconsistedof simply
convertingthe RGB image tograyscale and changingthe datatype tosingle ordouble sothat the var
functioncouldwork. The resultwasnot great. Finally,we triedtomake some adjustmentstothe code
to try and find some errorslike substitutingthe outputof the filterintoazeromatrix insteadof
substitutingitdirectlyintothe inputimage (eventhoughthathasworkedinpreviousfilteringmethods
such as medianfiltering). The resultturnedoutmuchbetterthanthe original butthe inputimage still
appearedtobe muchclearerthan the outputimage whichshowsthatthe filterwasinfact ineffective.
Conclusion:
In conclusion,the pointof anadaptive filteristouse the dynamicvariablesof animage,suchas the
statistical data,to alteran image toproduce a cleaneroutput. For the purposesof thisexperiment,it
didnot turn outso well. Youcan see the resultsinFigs.1 and 2. Also,Ihave addedthe resultsof
previouscomputerprogramsaswell asthe resultof usingthe built-inMatLabfunctionspecifically
designedforremovingGaussiannoise.
PreviousAttempts:
% Name: Chad Weiss
% Date: March 25, 2016
% Project: E E 458 Project 003
% Instructor: Dr. Aldo Morales
% This program implements an adaptive filtering technique that uses the
% statistical means and variances of the image to reduce gaussian noise.
clear all;clc;
% Read-In Image
I = imread('Neighbors.jpg'); Status = imfinfo('Neighbors.jpg');
% Add Noise to Image
noise_variance = 0.01;
J = imnoise(I,'gaussian',0,noise_variance);
% Zero Border
Input = [zeros(1,Status.Width,3);J;zeros(1,Status.Width,3)];
Input = [zeros(Status.Height+2,1,3),Input,zeros(Status.Height+2,1,3)];
imtool(Input);
% Noisy r,g and b planes (RGB format)
r = Input; r(:,:,2:3)=0;
g = Input; g(:,:,1)=0; g(:,:,3)=0;
b = Input; b(:,:,1:2)=0;
% Noisy r planes (HSV format)
r_hsv = rgb2hsv(r);
r_v = r_hsv(:,:,3);
% Noisy g planes (HSV format)
g_hsv = rgb2hsv(g);
g_v = g_hsv(:,:,3);
% Noisy b planes (HSV format)
b_hsv = rgb2hsv(b);
b_v = b_hsv(:,:,3);
% Define the Filter Mask
mask = zeros(3,3);
for i = 1:Status.Height
for j = 1:Status.Width
mask = r_v(i:i+2,j:j+2);
M = mean(reshape(mask,[],1)); %
Mean
V = var(reshape(mask,[],1)); %
Variance
output = (mask(5)-((noise_variance/V)*(mask(5)-M))); %
Output
r_v(i+1,j+1) = output; %
Insert Output
end
end
% Green Value Plane Loop
for i = 1:Status.Height
for j = 1:Status.Width
mask = g_v(i:i+2,j:j+2);
M = mean(reshape(mask,[],1));
V = var(reshape(mask,[],1));
output = (mask(5)-((noise_variance/V)*(mask(5)-M)));
g_v(i+1,j+1) = output;
end
end
% Blue Value Plane Loop
for i = 1:Status.Height
for j = 1:Status.Width
mask = b_v(i:i+2,j:j+2);
M = mean(reshape(mask,[],1));
V = var(reshape(mask,[],1));
output = (mask(5)-((noise_variance/V)*(mask(5)-M)));
b_v(i+1,j+1) = output;
end
end
Output = uint8(cat(3,(r_v*256),(g_v*256),(b_v*256)));
imtool(Output);
Figure 3: Noisy Input Image
Figure 4: Adaptive Filter Output Image
Usingthe MatLab filter:
% Name: Chad Weiss
% Date: March 25, 2016
% Project: E E 458 Project 003
% Instructor: Dr. Aldo Morales
% This program implements an adaptive filtering technique that uses the
% statistical means and variances of the image to reduce gaussian noise.
clear all;clc;
% Read-In Image
I = imread('Neighbors.jpg'); Status = imfinfo('Neighbors.jpg');
% Add Noise to Image
noise_variance = 0.03;
J = imnoise(I,'gaussian',0,noise_variance);
% Zero Border
Input = [zeros(1,Status.Width,3);J;zeros(1,Status.Width,3)];
Input = [zeros(Status.Height+2,1,3),Input,zeros(Status.Height+2,1,3)];
imtool(Input);
% Noisy r,g and b planes (RGB format)
r = Input; r(:,:,2:3)=0;
g = Input; g(:,:,1)=0; g(:,:,3)=0;
b = Input; b(:,:,1:2)=0;
R = double(r(:,:,1))/256; imtool(R);
G = double(g(:,:,2))/256; imtool(G);
B = double(b(:,:,3))/256; imtool(B);
% Define the Filter Mask
mask = zeros(3,3);
% Define Output Image
Output_R = wiener2(R);
Output_G = wiener2(G);
Output_B = wiener2(B);
% Display Output Image
imtool(Output_R); imtool(Output_G); imtool(Output_B);
Output = uint8(cat(3,Output_R*256,Output_G*256,Output_B*256));
imtool(Output);
Figure 5: Noisy Input Image
Figure 6: Noisy Input Red
Figure 7: Noisy Input Green
Figure 8: Noisy Input Blue
Figure 9: Filtered Red
Figure 10: Filtered Green
Figure 11: Filtered Blue
Figure 12: Filtered Output

Más contenido relacionado

La actualidad más candente

Image Processing Homework 1
Image Processing Homework 1Image Processing Homework 1
Image Processing Homework 1Joshua Smith
 
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editorIMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editorRAHUL DANGWAL
 
Gomory's cutting plane method
Gomory's cutting plane methodGomory's cutting plane method
Gomory's cutting plane methodRajesh Piryani
 
Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...thanh nguyen
 
Application of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimizationApplication of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimizationPranamesh Chakraborty
 
Comparative study of algorithms of nonlinear optimization
Comparative study of algorithms of nonlinear optimizationComparative study of algorithms of nonlinear optimization
Comparative study of algorithms of nonlinear optimizationPranamesh Chakraborty
 
Hand gesture recognition using discrete wavelet transform and hidden Markov m...
Hand gesture recognition using discrete wavelet transform and hidden Markov m...Hand gesture recognition using discrete wavelet transform and hidden Markov m...
Hand gesture recognition using discrete wavelet transform and hidden Markov m...TELKOMNIKA JOURNAL
 
Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionSimple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionAnish Patel
 
Integer Programming, Gomory
Integer Programming, GomoryInteger Programming, Gomory
Integer Programming, GomoryAVINASH JURIANI
 
Image enhancement using alpha rooting based hybrid technique
Image enhancement using alpha rooting based hybrid techniqueImage enhancement using alpha rooting based hybrid technique
Image enhancement using alpha rooting based hybrid techniqueRahul Yadav
 
Model Presolve, Warmstart and Conflict Refining in CP Optimizer
Model Presolve, Warmstart and Conflict Refining in CP OptimizerModel Presolve, Warmstart and Conflict Refining in CP Optimizer
Model Presolve, Warmstart and Conflict Refining in CP OptimizerPhilippe Laborie
 
PCA and LDA in machine learning
PCA and LDA in machine learningPCA and LDA in machine learning
PCA and LDA in machine learningAkhilesh Joshi
 
Tomato Classification using Computer Vision
Tomato Classification using Computer VisionTomato Classification using Computer Vision
Tomato Classification using Computer VisionRaman Pandey
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab SangeethaSasi1
 
Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...
Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...
Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...IRJET Journal
 

La actualidad más candente (18)

Image Processing Homework 1
Image Processing Homework 1Image Processing Homework 1
Image Processing Homework 1
 
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editorIMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
 
Gomory's cutting plane method
Gomory's cutting plane methodGomory's cutting plane method
Gomory's cutting plane method
 
ippseminar
ippseminarippseminar
ippseminar
 
Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...
 
Application of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimizationApplication of recursive perturbation approach for multimodal optimization
Application of recursive perturbation approach for multimodal optimization
 
Comparative study of algorithms of nonlinear optimization
Comparative study of algorithms of nonlinear optimizationComparative study of algorithms of nonlinear optimization
Comparative study of algorithms of nonlinear optimization
 
Hand gesture recognition using discrete wavelet transform and hidden Markov m...
Hand gesture recognition using discrete wavelet transform and hidden Markov m...Hand gesture recognition using discrete wavelet transform and hidden Markov m...
Hand gesture recognition using discrete wavelet transform and hidden Markov m...
 
Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionSimple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
 
Integer Programming, Gomory
Integer Programming, GomoryInteger Programming, Gomory
Integer Programming, Gomory
 
MUMS: Transition & SPUQ Workshop - Dimension Reduction and Global Sensititvit...
MUMS: Transition & SPUQ Workshop - Dimension Reduction and Global Sensititvit...MUMS: Transition & SPUQ Workshop - Dimension Reduction and Global Sensititvit...
MUMS: Transition & SPUQ Workshop - Dimension Reduction and Global Sensititvit...
 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
 
Image enhancement using alpha rooting based hybrid technique
Image enhancement using alpha rooting based hybrid techniqueImage enhancement using alpha rooting based hybrid technique
Image enhancement using alpha rooting based hybrid technique
 
Model Presolve, Warmstart and Conflict Refining in CP Optimizer
Model Presolve, Warmstart and Conflict Refining in CP OptimizerModel Presolve, Warmstart and Conflict Refining in CP Optimizer
Model Presolve, Warmstart and Conflict Refining in CP Optimizer
 
PCA and LDA in machine learning
PCA and LDA in machine learningPCA and LDA in machine learning
PCA and LDA in machine learning
 
Tomato Classification using Computer Vision
Tomato Classification using Computer VisionTomato Classification using Computer Vision
Tomato Classification using Computer Vision
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab
 
Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...
Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...
Implementation of an Effective Self-Timed Multiplier for Single Precision Flo...
 

Destacado

Destacado (15)

Pauta Digital
Pauta DigitalPauta Digital
Pauta Digital
 
CV
CVCV
CV
 
AN EXPERIMENTAL STUDY OF PERFORMANCE AND EMISSION CHARACTERISTICS OF CI ENGIN...
AN EXPERIMENTAL STUDY OF PERFORMANCE AND EMISSION CHARACTERISTICS OF CI ENGIN...AN EXPERIMENTAL STUDY OF PERFORMANCE AND EMISSION CHARACTERISTICS OF CI ENGIN...
AN EXPERIMENTAL STUDY OF PERFORMANCE AND EMISSION CHARACTERISTICS OF CI ENGIN...
 
THE THREE DIMENSION-BASED PHYSICAL ACCESS CONTROL DETECTION SYSTEM, THE NATUR...
THE THREE DIMENSION-BASED PHYSICAL ACCESS CONTROL DETECTION SYSTEM, THE NATUR...THE THREE DIMENSION-BASED PHYSICAL ACCESS CONTROL DETECTION SYSTEM, THE NATUR...
THE THREE DIMENSION-BASED PHYSICAL ACCESS CONTROL DETECTION SYSTEM, THE NATUR...
 
Sustainable tourism eliminatining poverty (step)
Sustainable tourism eliminatining poverty (step)Sustainable tourism eliminatining poverty (step)
Sustainable tourism eliminatining poverty (step)
 
Sustainable tourism eliminatining poverty (step)
Sustainable tourism eliminatining poverty (step)Sustainable tourism eliminatining poverty (step)
Sustainable tourism eliminatining poverty (step)
 
Presentacion practica secretarial i slideshare
Presentacion practica secretarial i slidesharePresentacion practica secretarial i slideshare
Presentacion practica secretarial i slideshare
 
EFFECT OF TOD AND GVD IN LONG-HAUL OFC SYSTEM
EFFECT OF TOD AND GVD IN LONG-HAUL OFC SYSTEMEFFECT OF TOD AND GVD IN LONG-HAUL OFC SYSTEM
EFFECT OF TOD AND GVD IN LONG-HAUL OFC SYSTEM
 
MANAGING INTERFERENCE IN COLLABORATIVE NETWORKS BY FLOW CONTROL AND SIGNAL PO...
MANAGING INTERFERENCE IN COLLABORATIVE NETWORKS BY FLOW CONTROL AND SIGNAL PO...MANAGING INTERFERENCE IN COLLABORATIVE NETWORKS BY FLOW CONTROL AND SIGNAL PO...
MANAGING INTERFERENCE IN COLLABORATIVE NETWORKS BY FLOW CONTROL AND SIGNAL PO...
 
Swrt(li)
Swrt(li)Swrt(li)
Swrt(li)
 
Wonder miranda
Wonder mirandaWonder miranda
Wonder miranda
 
чума
чумачума
чума
 
цестодозы
цестодозыцестодозы
цестодозы
 
c++ - if else
c++ - if elsec++ - if else
c++ - if else
 
Wegwijs in knesselare2014-2015
Wegwijs in knesselare2014-2015Wegwijs in knesselare2014-2015
Wegwijs in knesselare2014-2015
 

Similar a E E 458 Project 003

Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)Alex Larcheveque
 
E E 458 Project 002
E E 458 Project 002E E 458 Project 002
E E 458 Project 002Chad Weiss
 
Gauss Elimination Method With Partial Pivoting
Gauss Elimination Method With Partial PivotingGauss Elimination Method With Partial Pivoting
Gauss Elimination Method With Partial PivotingSM. Aurnob
 
Functional Programming in Java 8
Functional Programming in Java 8Functional Programming in Java 8
Functional Programming in Java 8Omar Bashir
 
Antenna Physical Characetristics
Antenna Physical CharacetristicsAntenna Physical Characetristics
Antenna Physical CharacetristicsAssignmentpedia
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7alish sha
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
Development of stereo matching algorithm based on sum of absolute RGB color d...
Development of stereo matching algorithm based on sum of absolute RGB color d...Development of stereo matching algorithm based on sum of absolute RGB color d...
Development of stereo matching algorithm based on sum of absolute RGB color d...IJECEIAES
 
rit seminars-privacy assured outsourcing of image reconstruction services in ...
rit seminars-privacy assured outsourcing of image reconstruction services in ...rit seminars-privacy assured outsourcing of image reconstruction services in ...
rit seminars-privacy assured outsourcing of image reconstruction services in ...thahirakabeer
 
SYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITION
SYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITIONSYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITION
SYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITIONijcsit
 
06 spatial filtering DIP
06 spatial filtering DIP06 spatial filtering DIP
06 spatial filtering DIPbabak danyal
 
Image Classification
Image ClassificationImage Classification
Image ClassificationAnwar Jameel
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)hhliu
 
Lecture_Spatial_Filters.pptx
Lecture_Spatial_Filters.pptxLecture_Spatial_Filters.pptx
Lecture_Spatial_Filters.pptxmahirazainab
 
Visual Quality for both Images and Display of Systems by Visual Enhancement u...
Visual Quality for both Images and Display of Systems by Visual Enhancement u...Visual Quality for both Images and Display of Systems by Visual Enhancement u...
Visual Quality for both Images and Display of Systems by Visual Enhancement u...IJMER
 

Similar a E E 458 Project 003 (20)

Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)
 
matlab.docx
matlab.docxmatlab.docx
matlab.docx
 
E E 458 Project 002
E E 458 Project 002E E 458 Project 002
E E 458 Project 002
 
Gauss Elimination Method With Partial Pivoting
Gauss Elimination Method With Partial PivotingGauss Elimination Method With Partial Pivoting
Gauss Elimination Method With Partial Pivoting
 
How to Make Hand Detector on Native Activity with OpenCV
How to Make Hand Detector on Native Activity with OpenCVHow to Make Hand Detector on Native Activity with OpenCV
How to Make Hand Detector on Native Activity with OpenCV
 
Functional Programming in Java 8
Functional Programming in Java 8Functional Programming in Java 8
Functional Programming in Java 8
 
Eigenfaces
EigenfacesEigenfaces
Eigenfaces
 
Antenna Physical Characetristics
Antenna Physical CharacetristicsAntenna Physical Characetristics
Antenna Physical Characetristics
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Development of stereo matching algorithm based on sum of absolute RGB color d...
Development of stereo matching algorithm based on sum of absolute RGB color d...Development of stereo matching algorithm based on sum of absolute RGB color d...
Development of stereo matching algorithm based on sum of absolute RGB color d...
 
rit seminars-privacy assured outsourcing of image reconstruction services in ...
rit seminars-privacy assured outsourcing of image reconstruction services in ...rit seminars-privacy assured outsourcing of image reconstruction services in ...
rit seminars-privacy assured outsourcing of image reconstruction services in ...
 
SYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITION
SYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITIONSYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITION
SYMMETRICAL WEIGHTED SUBSPACE HOLISTIC APPROACH FOR EXPRESSION RECOGNITION
 
06 spatial filtering DIP
06 spatial filtering DIP06 spatial filtering DIP
06 spatial filtering DIP
 
Image Classification
Image ClassificationImage Classification
Image Classification
 
dip.pdf
dip.pdfdip.pdf
dip.pdf
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
Lecture_Spatial_Filters.pptx
Lecture_Spatial_Filters.pptxLecture_Spatial_Filters.pptx
Lecture_Spatial_Filters.pptx
 
Visual Quality for both Images and Display of Systems by Visual Enhancement u...
Visual Quality for both Images and Display of Systems by Visual Enhancement u...Visual Quality for both Images and Display of Systems by Visual Enhancement u...
Visual Quality for both Images and Display of Systems by Visual Enhancement u...
 

Más de Chad Weiss

Advancing Sustainability
Advancing SustainabilityAdvancing Sustainability
Advancing SustainabilityChad Weiss
 
PLC Building Automation and Control Systems
PLC Building Automation and Control SystemsPLC Building Automation and Control Systems
PLC Building Automation and Control SystemsChad Weiss
 
Solar Panel Installations
Solar Panel InstallationsSolar Panel Installations
Solar Panel InstallationsChad Weiss
 
Recommendation Report
Recommendation ReportRecommendation Report
Recommendation ReportChad Weiss
 
Remote Sensing
Remote SensingRemote Sensing
Remote SensingChad Weiss
 
Advancing Sustainability
Advancing SustainabilityAdvancing Sustainability
Advancing SustainabilityChad Weiss
 
Mballa_Weiss_Lab6
Mballa_Weiss_Lab6Mballa_Weiss_Lab6
Mballa_Weiss_Lab6Chad Weiss
 

Más de Chad Weiss (14)

Advancing Sustainability
Advancing SustainabilityAdvancing Sustainability
Advancing Sustainability
 
PLC Building Automation and Control Systems
PLC Building Automation and Control SystemsPLC Building Automation and Control Systems
PLC Building Automation and Control Systems
 
Solar Panel Installations
Solar Panel InstallationsSolar Panel Installations
Solar Panel Installations
 
Recommendation Report
Recommendation ReportRecommendation Report
Recommendation Report
 
Remote Sensing
Remote SensingRemote Sensing
Remote Sensing
 
Advancing Sustainability
Advancing SustainabilityAdvancing Sustainability
Advancing Sustainability
 
Final Project
Final ProjectFinal Project
Final Project
 
Mballa_Weiss_Lab6
Mballa_Weiss_Lab6Mballa_Weiss_Lab6
Mballa_Weiss_Lab6
 
Lab 3
Lab 3Lab 3
Lab 3
 
E E 481 Lab 1
E E 481 Lab 1E E 481 Lab 1
E E 481 Lab 1
 
Final Project
Final ProjectFinal Project
Final Project
 
Project004
Project004Project004
Project004
 
Final Paper
Final PaperFinal Paper
Final Paper
 
Final Project
Final ProjectFinal Project
Final Project
 

E E 458 Project 003

  • 1. Penn State University E E 458 Project 3 Using Adaptive Filters to Remove Gaussian Noise By Chad RyanWeiss 4/6/2016
  • 2. Abstract: Adaptive filteringisapopulardigital image processingtechniquethatusesstatistical datafroman image to alterthe contentsof that image. The type of filterusedinthisreportwill take the variance andmean of the image andapplyit ina way that will hopefullyreduce the amountof Gaussiannoise presentinthe image. The firstpart of thisreportwill gointothe theorybehindadaptive filtering. Thenwe will apply thistheoryand create a MatLab computerprogramthat will remove unwantednoise fromanimage in the secondpart of thisreport.
  • 3. Theory: Adaptive Filtering Adaptive filtersuse dynamicvariablesasinputstoacquire a desiredoutput. Application: RemovingGaussianNoise % Name: Chad Weiss % Date: March 25, 2016 % Project: E E 458 Project 003 % Instructor: Dr. Aldo Morales % This program implements an adaptive filtering technique that uses the % statistical means and variances of the image to reduce gaussian noise. clear all;clc; % Read-In Image I = imread('Neighbors.jpg'); Status = imfinfo('Neighbors.jpg'); % Add Noise to Image noise_variance = 0.03; J = imnoise(I,'gaussian',0,noise_variance); % Zero Border Input = [zeros(1,Status.Width,3);J;zeros(1,Status.Width,3)]; Input = [zeros(Status.Height+2,1,3),Input,zeros(Status.Height+2,1,3)]; imtool(Input); % Noisy r,g and b planes (RGB format) r = Input; r(:,:,2:3)=0; g = Input; g(:,:,1)=0; g(:,:,3)=0; b = Input; b(:,:,1:2)=0; R = double(r(:,:,1))/256; G = double(g(:,:,2))/256; B = double(b(:,:,3))/256; % Define the Filter Mask mask = zeros(3,3); % Define Output Image Output_R = zeros(Status.Height+2, Status.Width+2); Output_G = zeros(Status.Height+2, Status.Width+2); Output_B = zeros(Status.Height+2, Status.Width+2); % Red Value Plane Loop for i = 1:Status.Height for j = 1:Status.Width mask = R(i:i+2,j:j+2); M = mean(reshape(mask,[],1)); % Mean V = var(reshape(mask,[],1)); output = (mask(5)-((noise_variance/V)*(mask(5)-M))); % Output if output < 0 output = 0;
  • 4. end if output > 1 output = 1; end Output_R(i+1,j+1) = output; % Insert Output end end % Green Value Plane Loop for i = 1:Status.Height for j = 1:Status.Width mask = G(i:i+2,j:j+2); M = mean(reshape(mask,[],1)); V = var(reshape(mask,[],1)); output = (mask(5)-((noise_variance/V)*(mask(5)-M))); if output < 0 output = 0; end if output > 1 output = 1; end Output_G(i+1,j+1) = output; end end % Blue Value Plane Loop for i = 1:Status.Height for j = 1:Status.Width mask = B(i:i+2,j:j+2); M = mean(reshape(mask,[],1)); V = var(reshape(mask,[],1)); output = (mask(5)-((noise_variance/V)*(mask(5)-M))); if output < 0 output = 0; end if output > 1 output = 1; end Output_B(i+1,j+1) = output; end end Output = uint8(cat(3,Output_R*256,Output_G*256,Output_B*256)); imtool(Output);
  • 5. Figure 1: Noisy Input Figure 2: Adaptive Filter Output
  • 6. Analysis: The code breaksdownlike so: 1. Read-Inthe Image 2. AddNoise tothe Image 3. Create a ZeroBorder aroundthe perimeterof the image 4. Isolate the Red, Green andBlue Planes 5. Convertto type single ordouble 6. Define the 3-by-3mask 7. Fill the maskwiththe noisyimage values 8. Determine the variance andmeanof the mask 9. Applythe formula(highlightedinyellow) 10. Setthe centervalue of the maskequal tothe outputof the formulaand applytoa similarsize zeromatrix 11. Repeatforthe Greenand Blue Planes 12. Concatenate the three planestoformthe final output 13. Displaythe InputandOutputimagesforcomparison Discussion: It was difficulttogetthisfiltertoproduce a clearoutputdespite severaldifferentapproaches. First,we triedconvertingRGN to HSV formatbut foundoutthat thistype of filterdidnotworkat all on the Hue and Saturationplanesof the images;furthermore,itproducedaveryinconsistentsmearingof the Gaussiannoise acrossthe V planesof the HSV images. The secondattemptconsistedof simply convertingthe RGB image tograyscale and changingthe datatype tosingle ordouble sothat the var functioncouldwork. The resultwasnot great. Finally,we triedtomake some adjustmentstothe code to try and find some errorslike substitutingthe outputof the filterintoazeromatrix insteadof substitutingitdirectlyintothe inputimage (eventhoughthathasworkedinpreviousfilteringmethods such as medianfiltering). The resultturnedoutmuchbetterthanthe original butthe inputimage still appearedtobe muchclearerthan the outputimage whichshowsthatthe filterwasinfact ineffective. Conclusion: In conclusion,the pointof anadaptive filteristouse the dynamicvariablesof animage,suchas the statistical data,to alteran image toproduce a cleaneroutput. For the purposesof thisexperiment,it didnot turn outso well. Youcan see the resultsinFigs.1 and 2. Also,Ihave addedthe resultsof previouscomputerprogramsaswell asthe resultof usingthe built-inMatLabfunctionspecifically designedforremovingGaussiannoise.
  • 7. PreviousAttempts: % Name: Chad Weiss % Date: March 25, 2016 % Project: E E 458 Project 003 % Instructor: Dr. Aldo Morales % This program implements an adaptive filtering technique that uses the % statistical means and variances of the image to reduce gaussian noise. clear all;clc; % Read-In Image I = imread('Neighbors.jpg'); Status = imfinfo('Neighbors.jpg'); % Add Noise to Image noise_variance = 0.01; J = imnoise(I,'gaussian',0,noise_variance); % Zero Border Input = [zeros(1,Status.Width,3);J;zeros(1,Status.Width,3)]; Input = [zeros(Status.Height+2,1,3),Input,zeros(Status.Height+2,1,3)]; imtool(Input); % Noisy r,g and b planes (RGB format) r = Input; r(:,:,2:3)=0; g = Input; g(:,:,1)=0; g(:,:,3)=0; b = Input; b(:,:,1:2)=0; % Noisy r planes (HSV format) r_hsv = rgb2hsv(r); r_v = r_hsv(:,:,3); % Noisy g planes (HSV format) g_hsv = rgb2hsv(g); g_v = g_hsv(:,:,3); % Noisy b planes (HSV format) b_hsv = rgb2hsv(b); b_v = b_hsv(:,:,3); % Define the Filter Mask mask = zeros(3,3); for i = 1:Status.Height for j = 1:Status.Width mask = r_v(i:i+2,j:j+2); M = mean(reshape(mask,[],1)); % Mean V = var(reshape(mask,[],1)); % Variance output = (mask(5)-((noise_variance/V)*(mask(5)-M))); % Output
  • 8. r_v(i+1,j+1) = output; % Insert Output end end % Green Value Plane Loop for i = 1:Status.Height for j = 1:Status.Width mask = g_v(i:i+2,j:j+2); M = mean(reshape(mask,[],1)); V = var(reshape(mask,[],1)); output = (mask(5)-((noise_variance/V)*(mask(5)-M))); g_v(i+1,j+1) = output; end end % Blue Value Plane Loop for i = 1:Status.Height for j = 1:Status.Width mask = b_v(i:i+2,j:j+2); M = mean(reshape(mask,[],1)); V = var(reshape(mask,[],1)); output = (mask(5)-((noise_variance/V)*(mask(5)-M))); b_v(i+1,j+1) = output; end end Output = uint8(cat(3,(r_v*256),(g_v*256),(b_v*256))); imtool(Output); Figure 3: Noisy Input Image
  • 9. Figure 4: Adaptive Filter Output Image Usingthe MatLab filter: % Name: Chad Weiss % Date: March 25, 2016 % Project: E E 458 Project 003 % Instructor: Dr. Aldo Morales % This program implements an adaptive filtering technique that uses the % statistical means and variances of the image to reduce gaussian noise. clear all;clc; % Read-In Image I = imread('Neighbors.jpg'); Status = imfinfo('Neighbors.jpg'); % Add Noise to Image noise_variance = 0.03; J = imnoise(I,'gaussian',0,noise_variance); % Zero Border Input = [zeros(1,Status.Width,3);J;zeros(1,Status.Width,3)]; Input = [zeros(Status.Height+2,1,3),Input,zeros(Status.Height+2,1,3)]; imtool(Input); % Noisy r,g and b planes (RGB format) r = Input; r(:,:,2:3)=0; g = Input; g(:,:,1)=0; g(:,:,3)=0;
  • 10. b = Input; b(:,:,1:2)=0; R = double(r(:,:,1))/256; imtool(R); G = double(g(:,:,2))/256; imtool(G); B = double(b(:,:,3))/256; imtool(B); % Define the Filter Mask mask = zeros(3,3); % Define Output Image Output_R = wiener2(R); Output_G = wiener2(G); Output_B = wiener2(B); % Display Output Image imtool(Output_R); imtool(Output_G); imtool(Output_B); Output = uint8(cat(3,Output_R*256,Output_G*256,Output_B*256)); imtool(Output); Figure 5: Noisy Input Image
  • 11. Figure 6: Noisy Input Red Figure 7: Noisy Input Green
  • 12. Figure 8: Noisy Input Blue Figure 9: Filtered Red
  • 13. Figure 10: Filtered Green Figure 11: Filtered Blue