% testing the effects of the scanner noise to the signal

clear;

% signal image
I = imread('blackwhite.jpg', 'jpg');
W = imread('blackwhite1.jpg', 'jpg' );


IR = I(:, :, 1);
IG = I(:, :, 2);
IB = I(:, :, 3);

WR = W(:, :, 1);
WG = W(:, :, 2);
WB = W(:, :, 3);


figure(1);
image(I);
grid;


S1 = IR(1000, : );
S2 = IR(1200, : );
S3 = IR(1400, : );

figure(2);
subplot(3, 1, 1);
plot(S3);
title(' One-Dimensional Signal of the Black and White pattern image ');
grid;
subplot(3,1, 2);
plot( S3(600: 2100) );
grid;
subplot(3, 1, 3);
plot( S3(800: 1100) );
grid;

segment = S3(789: 814);
Avg = mean(segment)
Standard = std( double( segment ))
SNR = Avg / Standard


figure(3);
image(W);
grid;

Q1 = WR(1000, : );
Q2 = WR(1200, : );
Q3 = WR(1400, : );



t = 0: 0.001: 1;
x = 10 * cos( 2 * pi * 288 * t );

figure(4);
subplot(3, 1, 1);
plot(Q3);
title(' One-Dimensional Signal of the Black and White pattern image ');
grid;
subplot(3,1, 2);
plot( Q3(1100: 1300) );
title(' Enlarge signal ');
grid;
subplot(3, 1, 3);
plot( x(100: 300) );
title(' Original Designed Signal ');
grid;

t = 0: 0.001: 1;
x = 10 * cos( 2 * pi * 288 * t );

segment1 = Q3(789: 814);
Avg1 = mean(segment1)
Standard1 = std( double( segment1 ))
SNR1 = Avg1 / Standard1

FrequencyQ3 = fftshift( fft(Q3(600: 2000) ) );
Frequencyx = fftshift( fft(x) ) ;

figure(5);
subplot(2,1, 1);
plot( abs( Frequencyx) );
title(' Frequency Response of the Original Designed Signal ');
grid;
subplot(2, 1, 2);
plot( abs( FrequencyQ3) );
title(' Frequency Response of the Scanned Signal ');
grid;





