From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 3176/CH2/EX2.6/Ex2_6.sce | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 3176/CH2/EX2.6/Ex2_6.sce (limited to '3176/CH2/EX2.6') diff --git a/3176/CH2/EX2.6/Ex2_6.sce b/3176/CH2/EX2.6/Ex2_6.sce new file mode 100644 index 000000000..8eb91a2b2 --- /dev/null +++ b/3176/CH2/EX2.6/Ex2_6.sce @@ -0,0 +1,37 @@ +//Ex2_6 +//Image Subtraction for Enhancing differences +// Version : Scilab 5.4.1 +// Operating System : Window-xp, Window-7 +//Toolbox: Image Processing Design 8.3.1-1 +//Toolbox: SIVP 0.5.3.1-2 +//Reference book name : Digital Image Processing +//book author: Rafael C. Gonzalez and Richard E. Woods + +clc; +close; +clear; +xdel(winsid())//to close all currently open figure(s). +gray=imread("Ex2_6.tif"); +gray=imresize(gray,0.25,'bicubic'); //Resize the Image with bicubic Interpolation +figure,ShowImage(gray,'Gray Image'); +title('Original Image'); +[nr nc]=size(gray); +for i=1:8 + c(:,:,i)=mtlb_logical(bitget(gray,9-i)); // Separate bit Planes from the Gray Scale Image + +end +c(:,:,8)=zeros(nr,nc); // Set Zeros to LSB +//c(:,:,7)=zeros(nr,nc); // Set Zeros to LSB + +for i=1:nr + for j=1:nc + mask(i,j)=(2^7)*c(i,j,1)+(2^6)*c(i,j,2)+(2^5)*c(i,j,3)+(2^4)*c(i,j,4)+(2^3)*c(i,j,5)+(2^2)*c(i,j,6)+(2^1)*c(i,j,7)+(2^0)*c(i,j,8); + end +end +figure;ShowImage(mask,'Modified Image'); +title('Image Obtained by Setting Zeros to LSB '); +mask=uint8(mask); //Convert the Image to uint8 Data Type +Diff_image=imsubtract(gray,mask); //Subtract two Images +Diff_image=mat2gray(Diff_image); +figure;ShowImage(Diff_image,'Modified Image'); +title('Difference of two images'); -- cgit