Question: Find SNR for different values 2 5 , 5 0 , 7 5 , and 1 0 0 of the noise std ( standard deviation

Find SNR for different values 25,50,75, and 100 of the noise std (standard
deviation) and plot the results graph,Empirical Resolution,Calculated Resolution,Percentage error,SNR vs. Noise Graph? clc; clear all;
imfinfo('example1.jpg')
II=imread('example1.jpg');
II=double(II); %convert data type to double
%%
figure; imshow(II,[]);
BW = roipoly; %select a region to find SNR
ind=find(BW==1); %find the pixels that are selected
bw_image = zeros(size(II)); %make a array same size as the image
bw_image(ind)=1; %convert the array into a binary image
hold on;
imcontour(bw_image,1,'r'); %display the contour
figure;imshow(bw_image,[]); title('Binary Image');%display the binary image
%FINDING SNR FOR NOISE-FREE IMAGE
%=================================
mu = mean(II(ind)); %find the mean in the selected region
sd = std(II(ind)); %find the standard deviation in the selected region
SNR=log(mu/sd); %find the SNR in dB
disp('The SNR for noise free image in dB is:'); SNR %
%ADD NOISE
%================================
dim=size(II); %get the dimension of the image
noise=random('norm',0,50,[dim(1,1),dim(1,2)]); %generate random noise
% same size as the image
II_noisy=II+noise; %add noise to the image
figure;imshow(II_noisy,[])
BW = roipoly; %select a region to find SNR
ind=find(BW==1); %find the pixels that are selected
bw_image = zeros(size(II)); %make a array same size as the image
bw_image(ind)=1; %convert the array into a binary image
hold on;
imcontour(bw_image,1,'r'); %display the contour
figure;imshow(bw_image,[]); title('Binary Image');%display the binary image
%FINDING SNR FOR NOISY IMAGE
%=================================
mu_noisy = mean(II_noisy(ind)); %find the mean in the selected region
sd_noisy= std(II_noisy(ind)); %find the standard deviation in the selected
region
SNR_noisy=log(mu_noisy/sd_noisy); %find the SNR in dB
disp('The SNR for noisy image in dB is:'); SNR_noisy %

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!