Generation of test signals
Aim: To generate the test signals
(a) Unit impulse signal (b) Unit step sequence (c) Ramp sequence (d) Exponential sequence (e) Sine sequence (f) Cosine sequence.
Apparatus: MATLAB Version 7.8 (R2009a) Program:
%program for the generation of unit impulse signal clc ; clear all ; close all ; t=-2:1:2 ; y=[zeros(1,2),ones(1,1),zeros(1,2)] ; subplot(3,2,1) ; stem(t,y) ; ylabel('amplitude ---->') ; xlabel('(a)n ---->') ; title(' unit impulse signal ') ; %program for the generation of unit step sequence [u(n)-u(n-N)] n=input('enter the N value ') ; t=0:1:n-1 ; y=ones(1,n) ; subplot(3,2,2) ; 1
stem(t,y) ; ylabel('amplitude ---->') ; xlabel('(b)n ---->') ; title(' unit step sequence ') ; %program for the generation of ramp sequence n=input('enter the length of ramp sequence ') ; t=0:n-1 ; subplot(3,2,3) ; stem(t,t) ; ylabel('amplitude ---->') ; xlabel('(c)n ---->') ; title(' ramp sequence ') ; %program for the generation of exponential sequence n=input('enter the length of exponential sequence') ; t=0:n ; a=input('enter the value of a ') ; y=exp(a*t) ; subplot(3,2,4) ; stem(t,y) ; ylabel('amplitude ---->') ; xlabel('(d)n ---->') ; title(' exponential sequence ') ; %program for the generation of sine sequence t=0:0.01:pi ; y=sin(2*pi*t) ; subplot(3,2,5) ; plot(t,y) ; ylabel('amplitude ---->') ; 2
xlabel('(e)n ---->') ; title(' sine sequence ') ; %program for the generation of cosine sequence t=0:0.01:pi ; y=cos(2*pi*t) ; subplot(3,2,6) ; plot(t,y) ; ylabel('amplitude ---->') ; xlabel('(f)n ---->') ; title(' cosine sequence ') ;
Result:
Fig: test signals
Parameters: Enter the value of N Enter the length of ramp sequence Enter the length of exponential sequence Enter the value of a : : : : 4 3 3 1
FIR Filter Design
Aim: To design chebyshev type-I FIR filters
(a) Low pass filter (b) High pass filter (c) Band pass filter (d) Band stop filter.
Apparatus: MATLAB Version 7.8 (R2009a) Program :
%program for the design of FIR low pass, high pass, band pass and band stop filter using %chebyshev window clc; close all; clear all; rp=input('enter the pass band ripple.......'); rs=input('enter the stop band ripple.......'); fs=input('enter the stop band freq.......'); fp=input('enter the pass band freq.......'); f=input('enter the sampling freq.......'); r=input('enter the ripple value in dB....'); wp=2*fp/f; ws=2*fs/f; num=-20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem); if(rem(n,2)==0) n=n+1; end 5
y=chebwin(n,r); %low pass filter b=fir1(n-1,wp,y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,1); plot(o/pi,m); ylabel('gain in dB------>'); xlabel('(a) normalised frequency---->'); title(low pass filter); %high pass filter b=fir1(n-1,wp,'high',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,2); plot(o/pi,m); ylabel('gain in dB------>'); xlabel('(b) normalised frequency---->'); title(high pass filter); %band pass filter wn=[wp ws]; b=fir1(n-1,wn,y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,3); plot(o/pi,m); ylabel('gain in dB------>'); xlabel('(c) normalised frequency---->'); 6
title(band pass filter); %band stop filter b=fir1(n-1,wn,'stop',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,4); plot(o/pi,m); ylabel('gain in dB------>'); xlabel('(d) normalised frequency---->'); title(stop band filter);
Result:
Fig: gain responses of low pass, high pass, band pass and band stop filters
Parameters: Enter the pass band ripple....... Enter the stop band ripple....... Enter the stop band freq....... Enter the pass band freq....... Enter the sampling freq....... Enter the ripple value in dB.... : 0.03 : 0.02 : 2400 : 1800 : 10000 : 40
IIR Filter Design
Aim: To design chebyshev type-I IIR filters
(a) Low pass filter. (b) High pass filter. (c) Band pass filter. (d) Band stop filter.
Apparatus: MATLAB Version 7.8 (R2009a) Program:
%program for the design of chebyshev type-I low pass digital filter clc ; close all ; clear all ; format long rp=input('enter the passband ripple........') ; rs=input('enter the stopband ripple........') ; wp=input('enter the passband freq........') ; ws=input('enter the stopband freq........') ; fs=input('enter the sampling frequency........') ; w1=2*wp/fs ; w2=2*ws/fs ; [n,wn]=cheb1ord(w1,w2,rp,rs) ; [b,a]=cheby1(n,rp,wn) ; w=0:0.01:pi ; [h,om]=freqz(b,a,w) ; m=20*log10(abs(h)); an=angle(h) ; subplot(2,1,1) ; 9
plot(om/pi,m) ; ylabel('gain in dB -------->') ; xlabel('(a) normalised frequency--------->') ; subplot(2,1,2) ; plot(om/pi,an) ; xlabel('(b) normalised frequency ---------->') ; ylabel('phase in radians ------------->') ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %program for the design of chebyshev type-I high pass filter clc ; close all ; clear all ; format long rp=input('enter the passband ripple........') ; rs=input('enter the stopband ripple........') ; wp=input('enter the passband freq........') ; ws=input('enter the stopband freq........') ; fs=input('enter the sampling frequency........') ; w1=2*wp/fs ; w2=2*ws/fs ; [n,wn]=cheb1ord(w1,w2,rp,rs) ; [b,a]=cheby1(n,rp,wn,'high') ; w=0:0.01/pi:pi ; [h,om]=freqz(b,a,w) ; m=20*log10(abs(h)); an=angle(h) ; subplot(2,1,1) ; plot(om/pi,m) ; ylabel('gain in dB -------->') ; xlabel('(a) normalised frequency --------->') ; 10
subplot(2,1,2) ; plot(om/pi,an) ; xlabel('(b) normalised frequency ---------->') ; ylabel('phase in radians ------------->') ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %program for the design of chebyshev type-I band pass digital filter clc ; close all ; clear all ; format long rp=input('enter the passband ripple........') ; rs=input('enter the stopband ripple........') ; wp=input('enter the passband freq........') ; ws=input('enter the stopband freq........') ; fs=input('enter the sampling frequency........') ; w1=2*wp/fs ; w2=2*ws/fs ; [n]=cheb1ord(w1,w2,rp,rs) ; wn=[w1,w2] ; [b,a]=cheby1(n,rp,wn,'bandpass') ; w=0:0.01:pi ; [h,om]=freqz(b,a,w) ; m=20*log10(abs(h)); an=angle(h) ; subplot(2,1,1) ; plot(om/pi,m) ; ylabel('gain in dB -------->') ; xlabel('(a) normalised frequency --------->') ; subplot(2,1,2) ; 11
plot(om/pi,an) ; xlabel('(b) normalised frequency ---------->') ; ylabel('phase in radians ------------->') ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %program for the design of chebyshev type-I band stop digital filter clc ; close all ; clear all ; format long rp=input('enter the passband ripple........') ; rs=input('enter the stopband ripple........') ; wp=input('enter the passband freq........') ; ws=input('enter the stopband freq........') ; fs=input('enter the sampling frequency........') ; w1=2*wp/fs ; w2=2*ws/fs ; [n]=cheb1ord(w1,w2,rp,rs) ; wn=[w1,w2] ; [b,a]=cheby1(n,rp,wn,'stop') ; w=0:0.1/pi:pi ; [h,om]=freqz(b,a,w) ; m=20*log10(abs(h)); an=angle(h) ; subplot(2,1,1) ; plot(om/pi,m) ; ylabel('gain in dB -------->') ; xlabel('(a) normalised frequency --------->') ; subplot(2,1,2) ; plot(om/pi,an) ; xlabel('(b) normalised frequency ---------->') ; ylabel('phase in radians ------------->') ; 12
Result:
(a) Low pass filter
Fig: chebyshev type-I low pass filter Parameters: Enter the pass band ripple Enter the stop band ripple Enter the pass band frequency Enter the stop band frequency Enter the sampling frequency : 0.2 : 45 : 1300 : 1500 : 10000
13
(b) High pass filter
Fig: chebyshev type-I high pass filter Parameters: Enter the pass band ripple Enter the stop band ripple Enter the pass band frequency Enter the stop band frequency Enter the sampling frequency : 0.3 : 60 : 1500 : 2000 : 9000
(c) Band pass filter 14
Fig: chebyshev type-I band pass filter Parameters: Enter the pass band ripple Enter the stop band ripple Enter the pass band frequency Enter the stop band frequency Enter the sampling frequency : 0.4 : 35 : 2000 : 2500 : 10000
15
(d) Band stop filter
Fig: chebyshev type-I band stop filter
Parameters: Enter the pass band ripple Enter the stop band ripple Enter the pass band frequency Enter the stop band frequency Enter the sampling frequency : 0.25 : 40 : 2500 : 2750 : 7000
16
Image Enhancement
Aim: To perform image enhancement operations
(a) Adding noise to an image (b) Enhance contrast of an image using histogram equalization (c) Adjusting image intensity values (d) Remove noise in an image using 2D median filtering
Apparatus: MATLAB Version 7.8(R2009a). Program :
%Adding noise to an image close all; clear all; I=imread(cameraman.tif); J=imnoise(I,'salt & pepper',0.15); figure, imshow(I) figure, imshow(J) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % program to Enhance contrast of an image using histogram equalization close all; clear all; I=imread('cameraman.tif'); J=histeq(I); figure, imshow(I); figure, imshow(J); 17
%program to adjust the intensity values close all; clear all; I=imread('cameraman.tif'); J=imadjust(I,[0.3 0.7]); figure, imshow(I); figure, imshow(J); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %program to perform 2D median filtering close all; clear all; I=imread('cameraman.tif'); J=imnoise(I,'salt & pepper',0.15); K=medfilt2(J); figure, imshow(I); figure, imshow(J); figure, imshow(K);
18
Result:
(a) Adding noise to an image
Fig: image before adding noise
Fig: image after adding noise 19
(b) Enhance contrast of an image using histogram equalization
Fig: image before enhancing contrast
Fig: image after enhancing contrast 20
(c) Adjusting image intensity values
Fig: image before adjusting intensity values
Fig: image after adjusting intensity values.
21
(d) Remove noise in an image using 2D median filtering
Fig: image before without noise
Fig: image after adding some noise
22
Fig: image after removing noise using 2D median filtering
23
Inverse Z-Transforms
Aim: To find inverse z-transform of the following z-domain signals
(a) 1/(1-(1.5*z^(-1))+(0.5*z^(-2))) (b) (z*sin(a))/(z^2 - 2*cos(a)*z + 1)
Apparatus: MATLAB Version 7.8 (R2009a). Program:
%program to determine the inverse z-transforms syms n z a X1=1/(1-(1.5*z^(-1))+(0.5*z^(-2))); disp('inverse z-transform of 1/(1-(1.5*z^(-1))+(0.5*z^(-2)));'); x1=iztrans(X1); simplify(x1) X2=(z*sin(a))/(z^2 - 2*cos(a)*z + 1); disp('inverse z-transform of (z*sin(a))/(z^2 - 2*cos(a)*z + 1'); x2=iztrans(X2); simplify(x2)
24
Result:
inverse z-transform of 1/(1-(1.5*z^(-1))+(0.5*z^(-2))) ans = 2 - (1/2)^n inverse z-transform of (z*sin(a))/(z^2 - 2*cos(a)*z + 1) ans = sin(a*n)
25
Poles and Zeros of Z-domain signals
Aim: To find poles and zeros of Z-domain signal (z^2+ (0.8*z) +0.8)/ (z^2+0.49)
and sketch the pole-zero plot.
Apparatus: MATLAB version 7.8 (R2009a). Program:
%program to determine poles &zeros of rational function of %(z^2+(0.8*z)+0.8)/(z^2+0.49) %to plot the poles and zeros in z-plane clear all; syms z num_coeff=[1 0.8 0.8];%find the factors of (z2+(0.8*z)+0.8) disp('roots of numerator polynomial (z2+(0.8*z)+0.8) are zeros '); zeros=roots(num_coeff) den_coeff=[1 0 0.49];%find the factors of z2+0.49 disp('roots of denominator polynomial z2+0.49 are poles '); poles=roots(den_coeff) H=tf('z'); Ts=0.1; H=tf([num_coeff],[den_coeff],Ts); zgrid on; pzmap(H);
26
Result:
roots of numerator polynomial (z2+(0.8*z)+0.8) are zeros zeros = -0.4000 + 0.8000i -0.4000 - 0.8000i roots of denominator polynomial z2+0.49 are poles poles = 0 + 0.7000i 0 - 0.7000i
27
DFT Properties
Aim:
To verify convolution and circular convolution properties of DFT. MATLAB Version 7.8 (R2009a)
Apparatus: Program:
%program to perform Circular convolution clear all; close all; a=input('enter the first sequence'); b=input('enter the second sequence'); y=0:1:length(a)-1; subplot(3,1,1); stem(y,a,'filled'); z=0:1:length(b)-1; subplot(3,1,2); stem(z,b,'filled'); c=cconv(a,b); m= length(c)-1; n=0:1:m; disp('output sequence'); disp(c); subplot(3,1,3); stem(n,c); xlabel('time index'); ylabel('amplitude');
28
% Program for convolution two sequence syms t real x1= exp(-2*t).*heaviside(t); x2= exp(-6*t).*heaviside(t); disp('Fourier Transform of x1(t ) is'); x1= fourier(x1) disp('Fourier Transform of x2(t ) is'); x2= fourier(x2) y=x1*x2; disp('let x3 be convolution of x1(t ) and x2(t)'); x3=ifourier(y,t)
29
Result:
Circular convolution: Fig: circular convolution of two given sequences Parameters: enter the first sequence enter the second sequence output sequence Convolution: x1 = 1/(2+i*w) Fourier Transform of x2(t ) is x2 = 1/(6+i*w) let x3 be convolution of x1(t ) and x2(t) x3 = 1/4*heaviside(t)*(-exp(-6*t)+exp(-2*t)) : [1 2 4] : [1 2] :1 4 8 8
Image Closing
Aim: To close an image using morphological operations Apparatus: MATLAB Version 7.8(R2009a) Program:
% Step-1. Read the image into the MATLAB workspace and view it. originalBW = imread('circles.png'); imshow(originalBW); % Step-2. Create a disk-shaped structuring element. Use a disk structuring % element to preserve the circular nature of the object. % Specify a radius of 10 pixels so that the largest gap gets filled. 30
se = strel('disk',10); % Step-3:Perform a morphological close operation on the image. closeBW = imclose(originalBW,se); figure, imshow(closeBW)
Result:
31
Fig: image before closing
Fig: image after closing
Image Dilation
Aim: To perform image dilation using morphological operations.
(a) Dilate a binary image with a vertical line structuring element. (b) Dilate a grayscale image with a rolling ball structuring element.
Apparatus: MATLAB Version 7.8(R2009a) Program:
% program to Dilate a binary image with a vertical line structuring element bw = imread('text.png'); se = strel('line',11,90); 32
bw2 = imdilate(bw,se); imshow(bw), title('Original') figure, imshow(bw2), title('Dilated') %Dilate a grayscale image with a rolling ball structuring element. I = imread('cameraman.tif'); se = strel('ball',5,5); I2 = imdilate(I,se); imshow(I), title('Original') figure, imshow(I2), title('Dilated')
Result:
(a) Dilate a binary image with a vertical line structuring element.
33
Fig: image before dilation with a vertical line structuring element.
Fig: image after dilation image with a rolling ball structuring element. (b) Dilate a grayscale image with a rolling ball structuring element.
34
Fig: image before dilation with rolling ball structuring element.
Fig: image after dilation with rolling ball structuring element.
Image Erosion
35
Aim: To perform image erosion using morphological operations
(a) Erode a binary image with a disk structuring element. (b) Erode a grayscale image with a rolling ball.
Apparatus: MATLAB Version 7.8(R2009a) Program:
%Erode a binary image with a disk structuring element. originalBW = imread('circles.png'); se = strel('disk',11); erodedBW = imerode(originalBW,se); imshow(originalBW), figure, imshow(erodedBW)
% Erode a grayscale image with a rolling ball. I = imread('cameraman.tif'); se = strel('ball',5,5); I2 = imerode(I,se); imshow(I), title('Original') figure, imshow(I2), title('Eroded')
Result:
36
(a) Erode a binary image with a disk structuring element.
Fig: image before erosion with disk structuring element.
Fig: image after erosion with disk structuring element. (b) Erode a grayscale image with a rolling ball.
37
Fig: image before erosion with a rolling ball.
Fig: image after erosion with a rolling ball.
Image Opening
38
Aim: To Remove the smaller objects in an image. Apparatus: MATLAB Version 7.8(R2009a) Program:
% 1. Read the image into the MATLAB workspace and display it. I = imread('snowflakes.png'); imshow(I) % 2. Create a disk-shaped structuring element with a radius of 5 pixels. se = strel('disk',5); % 3. Remove snowflakes having a radius less than 5 pixels by opening it % with the disk-shaped structuring element created in step 2. I_opened = imopen(I,se); figure, imshow(I_opened,[])
Result:
39
Fig: image before Remove the smaller objects in an image.
Fig: image after Remove the smaller objects in an image.
Image Segmentation
40
Aim: To perform image segmentation operations on an image. Apparatus: MATLAB Version 7.8(R2009a) Program:
I = imread('cell.tif'); figure, imshow(I), title('original image'); [junk threshold] = edge(I, 'sobel'); fudgeFactor = .5; BWs = edge(I,'sobel', threshold * fudgeFactor); figure, imshow(BWs), title('binary gradient mask'); se90 = strel('line', 3, 90); se0 = strel('line', 3, 0); BWsdil = imdilate(BWs, [se90 se0]); figure, imshow(BWsdil), title('dilated gradient mask'); BWdfill = imfill(BWsdil, 'holes'); figure, imshow(BWdfill); title('binary image with filled holes'); BWnobord = imclearborder(BWdfill, 4); figure, imshow(BWnobord), title('cleared border image'); seD = strel('diamond',1); BWfinal = imerode(BWnobord,seD); BWfinal = imerode(BWfinal,seD); figure, imshow(BWfinal), title('segmented image'); BWoutline = bwperim(BWfinal); Segout = I; Segout(BWoutline) = 255; figure, imshow(Segout), title('outlined original image');
Result:
41
Fig: original image before segmentation
Fig: image of binary gradient mask
Fig: image of dilated gradient mask 42
Fig: image of binary image with filled holes
Fig: image of cleared border image
Fig: segmented image 43
Fig: outlined original image
Spatial Transformations
Aim: To perform
(a) Resizing an image (b) Rotating an image (c) Cropping an image using Spatial Transformations
Apparatus: MATLAB Version 7.8(R2009a) Program:
% Resizing an Image 44
% To resize an image, use the imresize function. When you resize an image, % you specify the image to be resized and the magnification factor. % To enlarge an image, specify a magnification factor greater than 1. % To reduce an image, specify a magnification factor between 0 and 1. % For example, the command below increases the size of an image by 1.25 times. I = imread('circuit.tif'); J = imresize(I,1.25); imshow(I) figure, imshow(J) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
% To rotate an image, use the imrotate function. When you rotate an image, % you specify the image to be rotated and the rotation angle, in degrees. % If you specify a positive rotation angle, imrotate rotates the image % counterclockwise; if you specify a negative rotation angle, imrotate % rotates the image clockwise. % This example rotates an image 35 counterclockwise and specifies bilinear interpolation. I = imread('circuit.tif'); J = imrotate(I,35,'bilinear'); 45
imshow(I) figure, imshow(J) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% I = imread('circuit.tif'); J = imcrop(I); I = imread('circuit.tif'); J = imcrop(I,[60 40 100 90]); % [xmin ymin width height].
Result:
(a) Resizing an image
46
Fig: image before resizing
Fig: image after resizing (b) Rotating an image
47
Fig: image before rotating
Fig: image after rotating (c) Cropping an image 48
Fig: image of cropping
Texture Segmentation
49
Aim: To perform texture segmentation operations on an image. Apparatus: MATLAB Version 7.8(R2009a) Program:
clc; clear all; close all; %Step 1: Read Image I = imread('bag.png'); figure, imshow(I); %Step 2: Create Texture Image %Use entropyfilt to create a texture image. The function %entropyfilt returns an array where each output pixel %contains the entropy value of the 9-by-9 neighborhood %around the corresponding pixel in the input image I. %Entropy is a statistical measure of randomness. E = entropyfilt(I); %Use mat2gray to rescale the texture image E so that its %values are in the default range for a double image. Eim = mat2gray(E); figure, imshow(Eim); %Step 3: Create Rough Mask for the Bottom Texture %Threshold the rescaled image Eim to segment the textures. %A threshold value of 0.8 is selected because it is roughly %the intensity value of pixels along the boundary between the %textures. BW1 = im2bw(Eim, .8); figure, imshow(BW1); figure, imshow(I); %The segmented objects in the binary image BW1 are white. %If you compare BW1 to I, you notice the top texture is overly %segmented (multiple white objects) and the bottom texture is 50
%segmented almost in its entirety. You can extract the bottom %texture using bwareaopen. BWao = bwareaopen(BW1,2000); figure, imshow(BWao); %Use imclose to smooth the edges and to close any open holes %in the object in BWao. A 9-by-9 neighborhood is selected because %this neighborhood was also used by entropyfilt. nhood = true(9); closeBWao = imclose(BWao,nhood); figure, imshow(closeBWao); %Use imfill to fill holes in the object in closeBWao. roughMask = imfill(closeBWao,'holes'); %Step 4: Use Rough Mask to Segment the Top Texture %Compare the binary image roughMask to the original image I. %Notice the mask for the bottom texture is not perfect because %the mask does not extend to the bottom of the image. However, %you can use roughMask to segment the top texture. figure, imshow(roughMask); figure, imshow(I); %Get raw image of the top texture using roughMask. I2 = I; I2(roughMask) = 0; figure, imshow(I2); %Use entropyfilt to calculate the texture image. E2 = entropyfilt(I2); E2im = mat2gray(E2); figure, imshow(E2im); %Threshold E2im using graythresh. BW2 = im2bw(E2im,graythresh(E2im)); figure, imshow(BW2) figure, imshow(I); 51
%If you compare BW2 to I, you notice there are two objects %segmented in BW2. Use bwareaopen to get a mask for the top texture. mask2 = bwareaopen(BW2,1000); figure, imshow(mask2); %Step 5: Display Segmentation Results %Use mask2 to extract the top and bottom texture from I. texture1 = I; texture1(~mask2) = 0; texture2 = I; texture2(mask2) = 0; figure, imshow(texture1); figure, imshow(texture2); %Outline the boundary between the two textures. boundary = bwperim(mask2); segmentResults = I; segmentResults(boundary) = 255; figure, imshow(segmentResults); %Using Other Texture Filters in Segmentation %Instead of entropyfilt, you can use stdfilt and rangefilt with %other morphological functions to achieve similar segmentation results. S = stdfilt(I,nhood); figure, imshow(mat2gray(S)); R = rangefilt(I,ones(5)); figure, imshow(R);
Result:
52
Fig: Reading texture image
Fig: Rescale the texture image using mat2gray
53
Fig: rough mask for bottom texture
Fig: original image
54
Fig: extraction of bottom texture using bwareaopen
Fig: Smoothening the edges
55
Fig: segmenting the top texture using rough mask
Fig: original image
56
Fig: Raw image using rough mask
Fig: Calculate the texture image using entropyfilt
57
Fig: Threshold E2im using graythresh
Fig: original image
58
Fig: Mask for the top texture using bwareopen
59
Fig: Extraction of top and bottom texture from I using mask2
Fig: Outline the boundary between the two texture
60
Fig: segmentation using stdfilt
Fig: segmentation using rangefilt
61