diff options
Diffstat (limited to 'Digital_Image_Processing_by_S_Jayaraman')
12 files changed, 3088 insertions, 0 deletions
diff --git a/Digital_Image_Processing_by_S_Jayaraman/1-Introduction_to_Image_Processing_System.ipynb b/Digital_Image_Processing_by_S_Jayaraman/1-Introduction_to_Image_Processing_System.ipynb new file mode 100644 index 0000000..08ab662 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/1-Introduction_to_Image_Processing_System.ipynb @@ -0,0 +1,116 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: Introduction to Image Processing System" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.13: False_contouring_Scilab_code.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: False contouring Scilab code\n", +"//Fig1.13\n", +"//page 13\n", +"clc;\n", +"close;\n", +"a =ReadImage('E:\DIP_JAYARAMAN\Chapter1\tigerpub.jpg');\n", +"a = uint8(a);\n", +"figure\n", +"imshow(a)\n", +"title('Original image');\n", +"//using 128 gray levels\n", +"figure\n", +"a_128 = grayslice(a,128);\n", +"gray_128 = gray(128);\n", +"ShowImage(a_128,'Image with 128 gray levels',gray_128); \n", +"//using 64 gray levels\n", +"figure\n", +"a_64 = grayslice(a,64);\n", +"gray_64 = gray(64);\n", +"ShowImage(a_64,'Image with 64 gray levels',gray_64); \n", +"//using 32 gray levels\n", +"figure\n", +"a_32 = grayslice(a,32);\n", +"gray_32 = gray(32);\n", +"ShowImage(a_32,'Image with 32 gray levels',gray_32);\n", +"//using 16 gray levels\n", +"figure\n", +"a_16 = grayslice(a,16);\n", +"gray_16 = gray(16);\n", +"ShowImage(a_16,'Image with 16 gray levels',gray_16);\n", +"//using 8 gray levels\n", +"a_8 = grayslice(a,8);\n", +"gray_8 = gray(8);\n", +"ShowImage(a_8,'Image with 8 gray levels',gray_8); " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.3: Program_to_calculate_number_of_samples_required_for_an_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Program to calculate number of samples required for an image\n", +"//Example1.3\n", +"//page 12\n", +"clc;\n", +"close;\n", +"//dimension of the image in inches\n", +"m = 4;\n", +"n = 6;\n", +"N = 400; //number of dots per inch in each direction\n", +"N2 = 2*N; //number of dots per inch in both horizontal & vertical\n", +"Fs = m*N2*n*N2;\n", +"disp(Fs,'Number of samples reuqired to preserve the information in the image=')\n", +"//Result\n", +"//Number of samples reuqired to preserve the information in the image= \n", +"//15360000." + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/10-Binary_Image_Processing.ipynb b/Digital_Image_Processing_by_S_Jayaraman/10-Binary_Image_Processing.ipynb new file mode 100644 index 0000000..24d9473 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/10-Binary_Image_Processing.ipynb @@ -0,0 +1,118 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10: Binary Image Processing" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.17: Scilab_Code_for_dilation_and_erosion_process.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab Code for dilation and erosion process\n", +"//Fig.10.17\n", +"//Page553\n", +"close;\n", +"clear;\n", +"clc;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter10\morph1.bmp'); //SIVP toolbox\n", +"//b =[1,1,1;1,1,1;1,1,1];\n", +"StructureElement = CreateStructureElement('square', 3) ;\n", +"a1 = DilateImage(a,StructureElement);\n", +"a2 = ErodeImage(a,StructureElement);\n", +"//Displaying original Image\n", +"//imshow(a)\n", +"figure(1)\n", +"ShowImage(a,'Original Image');\n", +"//Displaying Dilated Image\n", +"//imshow(a1)\n", +"figure(2)\n", +"ShowImage(a1,'Dilated Image');\n", +"xtitle('Dilated Image')\n", +"//Displaying Eroded Image\n", +"//imshow(a2)\n", +"figure(3)\n", +"ShowImage(a2,'Eroded Image');\n", +"xtitle('Eroded Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.19: Scilab_Code_to_perform_an_opening_and_closing_operation_on_the_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab Code to perform an opening and closing operation on the image\n", +"//Fig.10.19\n", +"//Page555\n", +"close;\n", +"clear;\n", +"clc;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter10\morph2.bmp'); //SIVP toolbox\n", +"//b =[1,1,1;1,1,1;1,1,1];\n", +"StructureElement = CreateStructureElement('square', 3) ;\n", +"//Opening is done by first applying erosion and then dilation operations on image\n", +"b1 = ErodeImage(a,StructureElement);\n", +"b2 = DilateImage(b1,StructureElement);\n", +"//Closing is done by first applying dilation and then erosion operation on image\n", +"a1 = DilateImage(a,StructureElement);\n", +"a2 = ErodeImage(a1,StructureElement);\n", +"//Displaying original Image\n", +"figure(1)\n", +"ShowImage(a,'Original Image');\n", +"//Displaying Opened Image\n", +"figure(2)\n", +"ShowImage(b2, 'Opened Image');\n", +"xtitle('Opened Image')\n", +"//Displaying Closed Image\n", +"figure(3)\n", +"ShowImage(a2, 'Closed Image');\n", +"xtitle('Closed Image')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/11-Colur_Image_Processing.ipynb b/Digital_Image_Processing_by_S_Jayaraman/11-Colur_Image_Processing.ipynb new file mode 100644 index 0000000..bc4db43 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/11-Colur_Image_Processing.ipynb @@ -0,0 +1,426 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11: Colur Image Processing" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.12: Read_a_Colour_image_and_separate_the_colour_image_into_red_green_and_blue_planes.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Read a Colour image and separate the colour image into: red,green\n", +"//and blue planes\n", +"//Fig.11.12: MATLAB Example2\n", +"//page592\n", +"clc;\n", +"close;\n", +"RGB = imread('E:\DIP_JAYARAMAN\Chapter11\peppers.png'); //SIVP toolbox\n", +"a1 = RGB;\n", +"b1 = RGB;\n", +"c1 = RGB;\n", +"a1(:,:,1)=0;\n", +"b1(:,:,2)=0;\n", +"c1(:,:,3)=0;\n", +"figure(1)\n", +"ShowColorImage(RGB, 'Original Color Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowColorImage(a1, 'Red Missing');\n", +"figure(3)\n", +"ShowColorImage(b1, 'Green Missing');\n", +"figure(4)\n", +"ShowColorImage(c1, 'Blue Missing');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.16: Compute_the_histogram_of_the_colour_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Compute the histogram of the colour image\n", +"//Fig.11.16: MATLAB Example3\n", +"//page595\n", +"clc;\n", +"close;\n", +"I = imread('E:\DIP_JAYARAMAN\Chapter11\lavender.jpg'); //SIVP toolbox\n", +"figure(1)\n", +"ShowColorImage(I, 'Original Color Image'); //IPD toolbox\n", +"J = im2double(I);\n", +"[index,map] = RGB2Ind(I); //IPD toolbox\n", +"pixels = prod(size(index));\n", +"hsv = rgb2hsv(J);\n", +"h = hsv(:,1);\n", +"s = hsv(:,2);\n", +"v = hsv(:,3);\n", +"//Finds location of black and white pixels\n", +"darks = find(v<0.2);\n", +"lights = find(s<0.05 & v>0.85);\n", +"h([darks lights])=-1;\n", +"//Gets the number of all pixels for each colour bin\n", +"black_pixels = length(darks)/pixels;\n", +"white_pixels = length(lights)/pixels;\n", +"red = length(find((h > .9167 | h <= .083) & h ~= -1))/pixels;\n", +"yellow = length(find(h > .083 & h <= .25))/pixels;\n", +"green = length(find(h > .25 & h <= .4167))/pixels;\n", +"cyan = length(find(h > .4167 & h <= .5833))/pixels;\n", +"blue = length(find(h > .5833 & h <= .75))/pixels;\n", +"magenta = length(find(h > .75 & h <= .9167))/pixels;\n", +"//Plots histogram\n", +"figure(2)\n", +"a=gca();\n", +"a.data_bounds=[0,0;8,1]\n", +"n = 0:0.1:1;\n", +"plot2d2(n,red*ones(1,length(n)),5)\n", +"n1 = 1:0.1:2;\n", +"plot2d2(n1,yellow*ones(1,length(n)),7)\n", +"n2 = 2:0.1:3;\n", +"plot2d2(n2,green*ones(1,length(n)),8)\n", +"n3 = 3:0.1:4;\n", +"plot2d2(n3,cyan*ones(1,length(n)),9)\n", +"n4 = 4:0.1:5;\n", +"plot2d2(n4,blue*ones(1,length(n)),2)\n", +"n5 = 5:0.1:6;\n", +"plot2d2(n5,magenta*ones(1,length(n)),3)\n", +"n6 = 6:0.1:7;\n", +"plot2d2(n6,white_pixels*ones(1,length(n)),0)\n", +"n7 = 7:0.1:8\n", +"plot2d2(n7,black_pixels*ones(1,length(n)),5)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.18: Perform_histogram_equalisation_of_the_given_RGB_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Perform histogram equalisation of the given RGB image\n", +"//Fig.11.18: MATLAB Example4\n", +"//page596\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter11\peppers.png'); //SIVP toolbox\n", +"//conversion of RGB to YIQ format\n", +"b = rgb2ntsc(a);\n", +"//Histogram equalisation of Y component alone\n", +"b(:,:,1) = \n", +"//conversion of YIQ to RGB format\n", +"c = ntsc2rgb(b);\n", +"figure(1)\n", +"ShowColorImage(a, 'Original Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowColorImage(c, 'Histogtram equalized Image'); //IPD toolbox" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.21: This_program_performs_median_filtering_of_the_colour_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:This program performs median filtering of the colour image\n", +"//Fig.11.21: MATLAB Example5\n", +"//page598\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter11\peppers.png'); //SIVP toolbox\n", +"b = imnoise(a, 'salt & pepper', 0.2);\n", +"c(:,:,1)= MedianFilter(b(:,:,1), [3 3]);\n", +"c(:,:,2)= MedianFilter(b(:,:,2), [3 3]); \n", +"c(:,:,3)= MedianFilter(b(:,:,3), [3 3]); \n", +"figure(1)\n", +"ShowColorImage(a, 'Original Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowColorImage(b, 'corrupted Image'); //IPD toolbox\n", +"figure(3)\n", +"ShowColorImage(c, 'Median Filtered Image'); //IPD toolbox" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.24: Fitlering_only_the_luminance_component.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Fitlering only the luminance component\n", +"//Fig.11.24: MATLAB Example6\n", +"//page599\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter11\peppers.png'); //SIVP toolbox\n", +"//conversion of RGB to YIQ format\n", +"yiq = rgb2ntsc(a);\n", +"//Extract the Y component alone\n", +"b = yiq(:,:,1);\n", +"h = [-1,-1,-1;-1,8,-1;-1,-1,-1];\n", +"//Perform high pass filtering only on Y component\n", +"c1 = conv2d2(b,h);\n", +"[m,n]= size(b);\n", +"for i =1:m\n", +" for j=1:n\n", +" D(i,j)= c1(i,j);\n", +" end\n", +"end\n", +"yiq(:,:,1)=D;\n", +"//convert YIQ to RGB format\n", +"a1 = ntsc2rgb(yiq);\n", +"figure(1)\n", +"ShowColorImage(a, 'Original Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowColorImage(a1, 'High Pass filtered Image'); //IPD toolbox" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.28: Perform_gamma_correction_for_the_given_colour_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Perform gamma correction for the given colour image\n", +"//Fig.11.28: MATLAB Example7\n", +"//page603\n", +"close;\n", +"clear;\n", +"clc;\n", +"I = imread('E:\DIP_JAYARAMAN\Chapter11\ararauna.png'); //SIVP toolbox\n", +"gamma_Value = 0.5;\n", +"max_intensity = 255; //for uint8 image\n", +"//Look up table creation\n", +"LUT = max_intensity.*(([0:max_intensity]./max_intensity).^gamma_Value);\n", +"LUT = floor(LUT);\n", +"//Mapping of input pixels into lookup table values\n", +"K = double(I)+1;\n", +"J = zeros(I);\n", +"[m,n,p]= size(K);\n", +"for i = 1:m\n", +" for j =1:n\n", +" for k = 1:p\n", +" J(i,j,k)= LUT(K(i,j,k));\n", +" end\n", +" end\n", +"end\n", +"figure(1)\n", +"ShowColorImage(I, 'Original Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowColorImage(uint8(J), 'Gamma Corrected Image'); //IPD toolbox" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.30: Perform_Pseudo_Colouring_Operation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Perform Pseudo-Colouring Operation\n", +"//Fig.11.30\n", +"//page604\n", +"close;\n", +"clear;\n", +"clc;\n", +"K = imread('E:\DIP_JAYARAMAN\Chapter11\lenna.jpg'); //SIVP toolbox\n", +"[m,n]= size(K);\n", +"I = uint8(K);\n", +"for i = 1:m\n", +" for j =1:n\n", +" if (I(i,j)>=0 & I(i,j)<50)\n", +" J(i,j,1)=I(i,j)+50;\n", +" J(i,j,2)=I(i,j)+100;\n", +" J(i,j,3)=I(i,j)+10;\n", +" elseif (I(i,j)>=50 & I(i,j)<100)\n", +" J(i,j,1)=I(i,j)+35;\n", +" J(i,j,2)=I(i,j)+128;\n", +" J(i,j,3)=I(i,j)+10;\n", +" elseif(I(i,j)>=100 & I(i,j)<150)\n", +" J(i,j,1)=I(i,j)+152;\n", +" J(i,j,2)=I(i,j)+130;\n", +" J(i,j,3)=I(i,j)+15;\n", +" elseif(I(i,j)>=150 & I(i,j)<200)\n", +" J(i,j,1)=I(i,j)+50;\n", +" J(i,j,2)=I(i,j)+140;\n", +" J(i,j,3)=I(i,j)+25;\n", +" elseif(I(i,j)>=200 & I(i,j)<=256)\n", +" J(i,j,1)=I(i,j)+120;\n", +" J(i,j,2)=I(i,j)+160;\n", +" J(i,j,3)=I(i,j)+45;\n", +" end\n", +" end\n", +"end\n", +"figure(1)\n", +"ShowImage(K, 'Original Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowColorImage(J, 'Pseudo Coloured Image'); //IPD toolbox" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.32: Read_an_RGB_image_and_segment_it_using_the_threshold_method.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Read an RGB image and segment it using the threshold method\n", +"//Fig11.32\n", +"//Page605\n", +"close;\n", +"clc;\n", +"I = imread('E:\DIP_JAYARAMAN\Chapter11\ararauna.png'); //SIVP toolbox\n", +"//Conversion of RGB to YCbCr\n", +"b = rgb2ycbcr_1(I); //SIVP toolbox\n", +"[m,n,p]=size(b);\n", +"b = uint8(b);\n", +"//Threshold is applied only to Cb component\n", +"mask = b(:,:,2)>120;\n", +"figure(1)\n", +"ShowColorImage(I,'Original Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowImage(mask, 'Segmented Image'); //IPD toolbox" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.4: Read_an_RGB_image_and_extract_the_three_colour_components_red_green_blue.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Read an RGB image and extract the three colour components: red,green\n", +"//and blue\n", +"//Fig.11.4: MATLAB Example1\n", +"//page588\n", +"clc;\n", +"close;\n", +"RGB = imread('E:\DIP_JAYARAMAN\Chapter11\peppers.png'); //SIVP toolbox\n", +"R = RGB;\n", +"G = RGB;\n", +"B = RGB;\n", +"R(:,:,2)=0;\n", +"R(:,:,3)=0;\n", +"G(:,:,1)=0;\n", +"G(:,:,3)=0;\n", +"B(:,:,1)=0;\n", +"B(:,:,2)=0;\n", +"figure(1)\n", +"ShowColorImage(RGB, 'Original Color Image'); //IPD toolbox\n", +"title('Original Color Image');\n", +"figure(2)\n", +"ShowColorImage(R, 'Red Component');\n", +"figure(3)\n", +"ShowColorImage(G, 'Green Component');\n", +"figure(4)\n", +"ShowColorImage(B, 'Blue Component');" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/12-Wavelet_based_Image_Processing.ipynb b/Digital_Image_Processing_by_S_Jayaraman/12-Wavelet_based_Image_Processing.ipynb new file mode 100644 index 0000000..a332949 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/12-Wavelet_based_Image_Processing.ipynb @@ -0,0 +1,271 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12: Wavelet based Image Processing" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.42: Scilab_code_to_generate_different_levels_of_a_Gaussian_pyramid.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code to generate different levels of a Gaussian pyramid\n", +"//Fig12.42\n", +"//Page651\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter12\apple3.bmp');\n", +"a = rgb2gray(a);\n", +"b = a;\n", +"kernelsize = input('Enter the size of the kernel:');\n", +"sd = input('Enter the standard deviation of hte Gaussian window:');\n", +"rf = input('Enter the Reduction Factor:');\n", +"//Routine to generate Gaussian kernel\n", +"k = zeros(kernelsize, kernelsize);\n", +"[m n] = size(b);\n", +"t = 0;\n", +"for i = 1:kernelsize\n", +" for j=1:kernelsize\n", +" k(i,j) = exp(-((i-kernelsize/2).^2+(j-kernelsize/2).^2)/(2*sd.^2))/(2*%pi*sd.^2);\n", +" t = t+k(i,j);\n", +" end\n", +"end\n", +"for i = 1:kernelsize\n", +" for j = 1:kernelsize\n", +" k(i,j) = k(i,j)/t;\n", +" end\n", +"end\n", +"for t = 1:1:rf\n", +" //convolve it with the picture\n", +" FilteredImg = b;\n", +" if t==1\n", +" FilteredImg = filter2(k,b)/255;\n", +" else\n", +" FilteredImg = filter2(k,b);\n", +" end;\n", +" //compute the size of the reduced image\n", +" m = m/2;\n", +" n = n/2;\n", +" //create the reduced image through sampling\n", +" b = zeros(m,n);\n", +" for i = 1:m\n", +" for j = 1:n\n", +" b(i,j) = FilteredImg(i*2,j*2);\n", +" end;\n", +" end;\n", +" end; \n", +"figure\n", +"ShowImage(a,'Original Image')\n", +"figure\n", +"ShowImage(b,'Different Levels of Gausain Pyramid')\n", +"title('Different Levels of Gausain Pyramid Level 2')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.57: Scilab_code_to_implement_watermarking_in_spatial_domain.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code to implement watermarking in spatial domain\n", +"//Fig12.57\n", +"//Page662\n", +"clc\n", +"close \n", +"a = imread('E:\DIP_JAYARAMAN\Chapter12\cameraman.jpg');\n", +"figure\n", +"imshow(a)\n", +"title('Base Image');\n", +"b = imread('E:\DIP_JAYARAMAN\Chapter12\keyimage.jpg');\n", +"b = rgb2gray(b);\n", +"b = imresize(b,[32 32],'bicubic');\n", +"[m1 n1]=size(b);\n", +"figure\n", +"imshow(b)\n", +"title('Mark Image');\n", +"[m n]=size(a);\n", +"i1 = 1;\n", +"j1 = 1;\n", +"p = 1;\n", +"c = a;\n", +"iii = 1;\n", +"jjj = 1;\n", +"a = uint8(a);\n", +"b = uint8(b);\n", +"for ff = 1:8\n", +" for i = 1:32\n", +" jjj = 1;\n", +" for j = j1:j1+n1-1\n", +" a(i,j) = bitand(a(i,j),uint8(254)); // LSB of base image is set to zero.\n", +" temp = bitand(b(i,jjj),uint8((2^ff)-1)); //MSB of the mark is extracted.\n", +" temp = temp/((2^ff)-1);\n", +" c(i,j) = bitor(a(i,j),uint8(temp));//MSB of mark is inerted into the %LSB of the base\n", +" jjj = jjj+1;\n", +" end\n", +" end\n", +" j1 = j1+32;\n", +"end\n", +"imshow(c)\n", +"title('Marked Image');\n", +"imwrite(c,'E:\DIP_JAYARAMAN\Chapter12\markimg.jpg');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.63: Scilab_code_to_implement_wavelet_based_watermarking.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code to implement wavelet-based watermarking\n", +"//Fig12.63\n", +"//Page666\n", +"clc;\n", +"close;\n", +"//Original Image\n", +"img = imread('E:\DIP_JAYARAMAN\Chapter12\cameraman.jpg');\n", +"figure\n", +"imshow(img)\n", +"title('Original Image');\n", +"[p q] = size(img);\n", +"//Generate the key\n", +"//key = imread('E:\DIP_JAYARAMAN\Chapter12\keyimg1.png');\n", +"//key = imresize(key,[p q]); \n", +"key = imread('E:\DIP_JAYARAMAN\Chapter12\keyimage.jpg');\n", +"key = rgb2gray(key);\n", +"c = 0.001; //Initialise the weight of Watermarking\n", +"figure\n", +"imshow(key)\n", +"title('Key');\n", +"//Wavelet transform of original image (base image)\n", +"img = double(img);\n", +"key = double(key);\n", +"[ca,ch,cv,cd] = dwt2(img,'db1');//Compute 2D wavelet transform\n", +"//Perform the watermarking\n", +"y = [ca ch;cv cd];\n", +"Y = y + c*key; \n", +"p=p/2;\n", +"q=q/2;\n", +"for i=1:p\n", +" for j=1:q\n", +" nca(i,j) = Y(i,j);\n", +" ncv(i,j) = Y(i+p,j);\n", +" nch(i,j) = Y(i,j+q);\n", +" ncd(i,j) = Y (i+p,j+q);\n", +" end\n", +"end\n", +"//Display the Watermarked image\n", +"wimg = idwt2(nca,nch,ncv,ncd,'db1');\n", +"wimg1 = uint8(wimg);\n", +"figure\n", +"imshow(wimg1)\n", +"title('Watermarked Image')\n", +"//Extraction of key from Watermarked image\n", +"[rca,rch,rcv,rcd] = dwt2(wimg,'db1'); //Compute 2D wavelet transform\n", +"n1=[rca,rch;rcv,rcd];\n", +"N1=n1-y;\n", +"N1 = N1*4;\n", +"N1 = im2int8(N1);\n", +"figure\n", +"imshow(N1)\n", +"title('Extract the key from watermarked image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.9: Scilab_code_to_perform_wavelet_decompositio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code to perform wavelet decomposition\n", +"//Fig12.10\n", +"//Page624\n", +"clc;\n", +"close;\n", +"x = ReadImage('E:\DIP_JAYARAMAN\Chapter12\lenna.jpg');\n", +"//The image in unsigned integer or double has to be converted into normalized\n", +"//double format\n", +"x = im2double(x);\n", +"//First Level decomposition\n", +"[CA,CH,CV,CD]=dwt2(x,'db1');\n", +"//Second level decomposition\n", +"[CA1,CH1,CV1,CD1]=dwt2(CA,'db1');\n", +"CA = im2int8(CA);\n", +"CH = im2int8(CH);\n", +"CV = im2int8(CV);\n", +"CD = im2int8(CD);\n", +"CA1 = im2int8(CA1);\n", +"CH1 = im2int8(CH1);\n", +"CV1 = im2int8(CV1);\n", +"CD1 = im2int8(CD1);\n", +"A = [CA,CH;CV,CD];\n", +"B = [CA1,CH1;CV1,CD1];\n", +"imshow(B)\n", +"title('Result of Second Level Decomposition')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/2-2D_Signals_and_Systems.ipynb b/Digital_Image_Processing_by_S_Jayaraman/2-2D_Signals_and_Systems.ipynb new file mode 100644 index 0000000..817a233 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/2-2D_Signals_and_Systems.ipynb @@ -0,0 +1,85 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: 2D Signals and Systems" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.12: Frequency_Response.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Frequency Response\n", +"//Fig2.12\n", +"//page 60\n", +"clc;\n", +"close;\n", +"[X, Y] = meshgrid(-%pi:.09:%pi);\n", +"Z = 2*cos(X)+2*cos(Y);\n", +"surf(X,Y,Z);\n", +"xgrid(1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.16: Frequency_Response.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Frequency Response\n", +"//Fig2.16\n", +"//page 64\n", +"clc;\n", +"close;\n", +"[X, Y] = meshgrid(-%pi:.05:%pi);\n", +"Z = 2-cos(X)-cos(Y);\n", +"surf(X,Y,Z);\n", +"xgrid(1)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/3-Convolution_and_Correlation.ipynb b/Digital_Image_Processing_by_S_Jayaraman/3-Convolution_and_Correlation.ipynb new file mode 100644 index 0000000..b7df1d7 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/3-Convolution_and_Correlation.ipynb @@ -0,0 +1,480 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: Convolution and Correlation" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.11: EX3_11.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Linear COnvolution of any signal with an impulse signal gives\n", +"//rise to the same signal\n", +"//Example3.11\n", +"//page 121\n", +"clc; \n", +"x =[1,2;3,4];\n", +"h = 1;\n", +"y = conv2d2(x,h);\n", +"disp(y,'Linear 2D convolution result y =')\n", +"//Result\n", +"//Linear 2D convolution result y = \n", +"//// Linear 2D convolution result y = \n", +"// \n", +"// 1. 2. \n", +"// 3. 4. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.12: Circular_Convolution_between_two_2D_matrices.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Circular Convolution between two 2D matrices\n", +"//Example3.12\n", +"//page 122\n", +"clc;\n", +"x = [1,2;3,4];\n", +"h = [5,6;7,8];\n", +"X = fft2d(x); //2D FFT of x matrix\n", +"H = fft2d(h); //2D FFT of h matrix\n", +"Y = X.*H; //Element by Element multiplication\n", +"y = ifft2d(Y); \n", +"disp(y,'Circular Convolution Result y =')\n", +"//Result\n", +"//Circular Convolution Result y = \n", +"// \n", +"// 70. 68. \n", +"// 62. 60." + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.1: 2D_Linear_Convlolution.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: 2-D Linear Convolution\n", +"//Example3.1 & Example3.4\n", +"//page 85 & page 107\n", +"clc;\n", +"x =[4,5,6;7,8,9];\n", +"h = [1;1;1];\n", +"disp(x,'x=')\n", +"disp(h,'h=')\n", +"[y,X,H] = conv2d2(x,h);\n", +"disp(y,'Linear 2D convolution result y =')\n", +"//Result\n", +"//Linear 2D convolution result y = \n", +"// \n", +"// 4. 5. 6. \n", +"// 11. 13. 15. \n", +"// 11. 13. 15. \n", +"// 7. 8. 9. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.13: Circular_Convolution_exspressed_as_linear_convolution_plus_alias.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Circular Convolution expressed as linear convolution plus alias\n", +"//Example3.13\n", +"//page 123\n", +"clc;\n", +"x = [1,2;3,4];\n", +"h = [5,6;7,8];\n", +"y = conv2d(x,h);\n", +"y1 = [y(:,1)+y(:,$),y(:,2)];\n", +"y2 = [y1(1,:)+y1($,:);y1(2,:)]\n", +"disp(y,'Linear Convolution result y=')\n", +"disp(y2,'circular convolution expessed as linear convolution plus alias =')\n", +"//Result\n", +"// Linear Convolution result y= \n", +"// \n", +"// 5. 16. 12. \n", +"// 22. 60. 40. \n", +"// 21. 52. 32. \n", +"// \n", +"// circular convolution expessed as linear convolution plus alias = \n", +"// \n", +"// 70. 68. \n", +"// 62. 60. \n", +"// " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.14: Linear_Cross_correlation_of_a_2D_matrix.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: linear cross correlation of a 2D matrix\n", +"//Example3.14\n", +"//page 129\n", +"clc;\n", +"x = [3,1;2,4];\n", +"h1 = [1,5;2,3];\n", +"h2 = h1(:,$:-1:1);\n", +"h = h2($:-1:1,:);\n", +"y = conv2d(x,h)\n", +"disp(y,'Linear cross Correlation result y=')\n", +"//Result\n", +"//Linear cross Correlation result y= \n", +"// \n", +"// 9. 9. 2. \n", +"// 21. 24. 9. \n", +"// 10. 22. 4. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.15: Circular_correlation_between_two_signals.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Circular correlation between two signals\n", +"//Example3.15\n", +"//page 131\n", +"clc;\n", +"x = [1,5;2,4];\n", +"h = [3,2;4,1];\n", +"h = h(:,$:-1:1);\n", +"h = h($:-1:1,:);\n", +"X = fft2d(x);\n", +"H = fft2d(h);\n", +"Y = X.*H;\n", +"y = ifft2d(Y);\n", +"disp(y,'Circular Correlation result y=')\n", +"//Result\n", +"//Circular Correlation result y= \n", +"// \n", +"// 37. 23. \n", +"// 35. 25." + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.16: Circular_correlation_between_two_signals.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Circular correlation between two signals\n", +"//Example3.16\n", +"//page 134\n", +"clc;\n", +"x = [5,10;15,20];\n", +"h = [3,6;9,12];\n", +"h = h(:,$:-1:1);\n", +"h = h($:-1:1,:);\n", +"X = fft2d(x);\n", +"H = fft2d(h);\n", +"Y = X.*H;\n", +"y = ifft2d(Y);\n", +"disp(y,'Circular Correlation result y=')\n", +"//Result\n", +"// Circular Correlation result y= \n", +"// \n", +"// 300. 330. \n", +"// 420. 450." + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.17: Linear_auto_correlation_of_a_2D_matrix.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: linear auto correlation of a 2D matrix\n", +"//Example3.17\n", +"//page 136\n", +"clc;\n", +"x1 = [1,1;1,1];\n", +"x2 = x1(:,$:-1:1);\n", +"x2 = x2($:-1:1,:);\n", +"x = conv2d(x1,x2)\n", +"disp(x,'Linear auto Correlation result x=')\n", +"//Result\n", +"//Linear auto Correlation result x= \n", +"// \n", +"// 1. 2. 1. \n", +"// 2. 4. 2. \n", +"// 1. 2. 1. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.18: Linear_Cross_correlation_of_a_2D_matrix.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: linear cross correlation of a 2D matrix\n", +"//Example3.18\n", +"//page 141\n", +"clc;\n", +"x = [1,1;1,1];\n", +"h1 = [1,2;3,4];\n", +"h2 = h1(:,$:-1:1);\n", +"h = h2($:-1:1,:);\n", +"y = conv2d(x,h)\n", +"disp(y,'Linear cross Correlation result y=')\n", +"//Result\n", +"//Linear cross Correlation result y= \n", +"// \n", +"// 4. 7. 3. \n", +"// 6. 10. 4. \n", +"// 2. 3. 1. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.2: 2D_Linear_Convolution.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: 2-D Linear Convolution\n", +"//Example3.2 & Example3.5 & Example3.9\n", +"//page 91 & page 108 & page 116\n", +"clc;\n", +"x =[1,2,3;4,5,6;7,8,9];\n", +"h = [1,1;1,1;1,1];\n", +"y = conv2d2(x,h);\n", +"disp(y,'Linear 2D convolution result y =')\n", +"//Result\n", +"// Linear 2D convolution result y = \n", +"// \n", +"// 1. 3. 5. 3. \n", +"// 5. 12. 16. 9. \n", +"// 12. 27. 33. 18. \n", +"// 11. 24. 28. 15. \n", +"// 7. 15. 17. 9. \n", +"// " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3: 2D_Linear_Convolution.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: 2-D Linear Convolution\n", +"//Example3.3 & Example3.6 & Example3.10\n", +"//page 100 & page 109 & page 119\n", +"clc;\n", +"x =[1,2,3;4,5,6;7,8,9];\n", +"h = [3,4,5];\n", +"y = conv2d2(x,h);\n", +"disp(y,'Linear 2D convolution result y =')\n", +"//Result\n", +"//Linear 2D convolution result y = \n", +"// \n", +"// 3. 10. 22. 22. 15. \n", +"// 12. 31. 58. 49. 30. \n", +"// 21. 52. 94. 76. 45." + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.7: 2D_Linear_Convolution.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: 2-D Linear Convolution\n", +"//Example3.7\n", +"//page 111\n", +"clc;\n", +"x =[1,2;3,4];\n", +"h = [5,6;7,8];\n", +"y = conv2d2(x,h);\n", +"disp(y,'Linear 2D convolution result y =')\n", +"//Result\n", +"// Linear 2D convolution result y = \n", +"//Linear 2D convolution result y = \n", +"// \n", +"// 5. 16. 12. \n", +"// 22. 60. 40. \n", +"// 21. 52. 32" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.8: 2D_Linear_Convolution.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: 2-D Linear Convolution\n", +"//Example3.8\n", +"//page 113\n", +"clc;\n", +"x =[1,2,3;4,5,6;7,8,9];\n", +"h = [1;1;1];\n", +"y = conv2d2(x,h);\n", +"disp(y,'Linear 2D convolution result y =')\n", +"//Result\n", +"// Linear 2D convolution result y = \n", +"//// 1. 2. 3. \n", +"// 5. 7. 9. \n", +"// 12. 15. 18. \n", +"// 11. 13. 15. \n", +"// 7. 8. 9. " + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/4-Image_Transforms.ipynb b/Digital_Image_Processing_by_S_Jayaraman/4-Image_Transforms.ipynb new file mode 100644 index 0000000..31133d0 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/4-Image_Transforms.ipynb @@ -0,0 +1,309 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: Image Transforms" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.10: Program_to_compute_discrete_cosine_transform.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Program to compute discrete cosine tranform\n", +"//Example4.10\n", +"//page 198\n", +"clc;\n", +"N =4; //DCT matrix of order four\n", +"X = dct_mtx(N);\n", +"disp(X,'DCT matrix of order four')\n", +"//Result\n", +"//DCT matrix of order four \n", +"// \n", +"// 0.5 0.5 0.5 0.5 \n", +"// 0.6532815 0.2705981 - 0.2705981 - 0.6532815 \n", +"// 0.5 - 0.5 - 0.5 0.5 \n", +"// 0.2705981 - 0.6532815 0.6532815 - 0.2705981 " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.12: Program_to_perform_KL_tranform_for_the_given_2D_matrix.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Program to perform KL transform for the given 2D matrix\n", +"//Example4.12\n", +"//page 208\n", +"clear;\n", +"clc;\n", +"X = [4,3,5,6;4,2,7,7;5,5,6,7];\n", +"[m,n]= size(X);\n", +"A = [];\n", +"E = [];\n", +"for i =1:n\n", +" A = A+X(:,i);\n", +" E = E+X(:,i)*X(:,i)';\n", +"end\n", +"mx = A/n; //mean matrix\n", +"E = E/n; \n", +"C = E - mx*mx';//covariance matrix C = E[xx']-mx*mx'\n", +"[V,D] = spec(C); //eigen values and eigen vectors\n", +"d = diag(D); //diagonal elements od eigen values\n", +"[d,i] = gsort(d); //sorting the elements of D in descending order\n", +"for j = 1:length(d)\n", +" T(:,j)= V(:,i(j));\n", +"end\n", +"T =T'\n", +"disp(d,'Eigen Values are U = ')\n", +"disp(T,'The eigen vector matrix T =')\n", +"disp(T,'The KL tranform basis is =')\n", +"//KL transform\n", +"for i = 1:n\n", +" Y(:,i)= T*X(:,i);\n", +"end\n", +"disp(Y,'KL transformation of the input matrix Y =')\n", +"//Reconstruction\n", +"for i = 1:n\n", +" x(:,i)= T'*Y(:,i);\n", +"end\n", +"disp(x,'Reconstruct matrix of the given sample matrix X =')\n", +"//Result\n", +"// Eigen Values are U = \n", +"// 6.1963372 \n", +"// 0.2147417 \n", +"// 0.0264211 \n", +"// The eigen vector matrix T = \n", +"// 0.4384533 0.8471005 0.3002988 \n", +"// 0.4460381 - 0.4951684 0.7455591 \n", +"// - 0.7802620 0.1929481 0.5949473 \n", +"// The KL tranform basis is = \n", +"// 0.4384533 0.8471005 0.3002988 \n", +"// 0.4460381 - 0.4951684 0.7455591 \n", +"// - 0.7802620 0.1929481 0.5949473 \n", +"// KL transformation of the input matrix Y = \n", +"// 6.6437095 4.5110551 9.9237632 10.662515 \n", +"// 3.5312743 4.0755729 3.2373664 4.4289635 \n", +"// 0.6254808 1.0198466 1.0190104 0.8336957 \n", +"// Reconstruct matrix of the given sample matrix x = \n", +"// 4. 3. 5. 6. \n", +"// 4. 2. 7. 7. \n", +"// 5. 5. 6. 7. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.13: Program_to_find_the_singular_value_decomposition_of_given_matrix.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Program to find the singular value decomposition of given matrix\n", +"//Example4.13\n", +"//page 210\n", +"clear;\n", +"clc;\n", +"A = [1,-2,3;3,2,-1];\n", +"[U,S,V]= svd(A);\n", +"A_recon = U*S*V';\n", +"disp(U,'U =')\n", +"disp(S,'S =')\n", +"disp(V,'V =')\n", +"disp(A_recon,'A matrix from svd =')\n", +"//Result\n", +"// U = \n", +"// \n", +"// - 0.7071068 0.7071068 \n", +"// 0.7071068 0.7071068 \n", +"// \n", +"// S = \n", +"// \n", +"// 4.2426407 0. 0. \n", +"// 0. 3.1622777 0. \n", +"// \n", +"// V = \n", +"// \n", +"// 0.3333333 0.8944272 - 0.2981424 \n", +"// 0.6666667 - 2.776D-16 0.7453560 \n", +"// - 0.6666667 0.4472136 0.5962848 \n", +"// \n", +"// A matrix from svd = \n", +"// \n", +"// 1. - 2. 3. \n", +"// 3. 2. - 1. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4: DFT_of_4x4_grayscale_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: 2D DFT of 4x4 grayscale image\n", +"//Example4.4\n", +"//page 170\n", +"clc;\n", +"f = [1,1,1,1;1,1,1,1;1,1,1,1;1,1,1,1];\n", +"N =4; //4-point DFT\n", +"kernel = dft_mtx(N);\n", +"F = kernel*(f*kernel');\n", +"disp(F,'2D DFT of given 2D image =')\n", +"//Result\n", +"//2D DFT of given 2D image = \n", +"// \n", +"// 16. 0 0 0 \n", +"// 0 0 0 0 \n", +"// 0 0 0 0 \n", +"// 0 0 0 0 " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5: 2D_DFT_of_4X4_grayscale_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: 2D DFT of 4x4 grayscale image\n", +"//Example4.5\n", +"//page 171\n", +"clc;\n", +"F = [16,0,0,0;0,0,0,0;0,0,0,0;0,0,0,0];\n", +"N =4; //4-point DFT\n", +"kernel = dft_mtx(N);\n", +"f = (kernel*(F*kernel'))/(N^2);\n", +"f = real(f);\n", +"disp(f,'Inverse 2D DFT of the transformed image f =')\n", +"//Result\n", +"//Inverse 2D DFT of the transformed image f = \n", +"// \n", +"// 1. 1. 1. 1. \n", +"// 1. 1. 1. 1. \n", +"// 1. 1. 1. 1. \n", +"// 1. 1. 1. 1. " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6: Scilab_code_to_intergchange_phase_information_between_two_images.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code to intergchange phase information between two images\n", +"//Example4.6\n", +"//page 174-175\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter4\lena.png'); //SIVP toolbox\n", +"b = imread('E:\DIP_JAYARAMAN\Chapter4\baboon.png');\n", +"a = rgb2gray(a);\n", +"b = rgb2gray(b);\n", +"a = imresize(a,0.5);\n", +"b = imresize(b,0.5);\n", +"figure(1)\n", +"ShowImage(a,'Original lena Image'); //IPD toolbox\n", +"title('Original lena Image'); \n", +"figure(2)\n", +"ShowImage(b,'Original baboon Image');\n", +"title('Original baboon Image')\n", +"ffta = fft2d(double(a));\n", +"fftb = fft2d(double(b));\n", +"mag_a = abs(ffta);\n", +"mag_b = abs(fftb);\n", +"ph_a = atan(imag(ffta),real(ffta));\n", +"ph_b = atan(imag(fftb),real(fftb));\n", +"newfft_a = mag_a.*(exp(%i*ph_b));\n", +"newfft_b = mag_b.*(exp(%i*ph_a));\n", +"rec_a = ifft2d(newfft_a);\n", +"rec_b = ifft2d(newfft_b);\n", +"figure(3)\n", +"ShowImage(uint8(rec_a),'lena Image after phase reversal');\n", +"title('lena Image after phase reversal')\n", +"figure(4)\n", +"ShowImage(uint8(rec_b),'baboon Image after phase reversal');\n", +"title('baboon Image after phase reversal')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/5-Image_Enhancement.ipynb b/Digital_Image_Processing_by_S_Jayaraman/5-Image_Enhancement.ipynb new file mode 100644 index 0000000..8d67e2f --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/5-Image_Enhancement.ipynb @@ -0,0 +1,256 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: Image Enhancement" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.13: Scilab_code_to_determine_image_negative.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code to determine image negative\n", +"//Fig.5.13\n", +"//page 252\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter5\label.jpg');\n", +"k = 255-double(a);\n", +"k = uint8(k);\n", +"imshow(a); \n", +"title('Original onca Image')\n", +"imshow(k); \n", +"title('Negative of Original Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.16: Scilab_code_that_performs_threshold_operatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code that performs threshold operation\n", +"//Fig5.16\n", +"//page 254\n", +"clc;\n", +"close;\n", +"a = imread('E:\Digital_Image_Processing_Jayaraman\Chapter5\lena.png');\n", +"a = rgb2gray(a);\n", +"[m n] = size(a);\n", +"t = input('Enter the threshold parameter');\n", +"for i = 1:m\n", +" for j = 1:n\n", +" if(a(i,j)<t)\n", +" b(i,j)=0;\n", +" else\n", +" b(i,j)=255;\n", +" end\n", +" end\n", +"end\n", +"figure(1)\n", +"ShowImage(a,'Original Image'); \n", +"title('Original Image')\n", +"figure(2)\n", +"ShowImage(b,'Thresholded Image'); \n", +"title('Thresholded Image')\n", +"xlabel(sprintf('Threshold value is %g',t))\n", +"//Result\n", +"//Enter the threshold parameter 140" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.20: Program_performs_gray_level_slicing_without_background.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Program performs gray level slicing without background\n", +"//Fig.5.20\n", +"//page256\n", +"clc;\n", +"x = imread('E:\Digital_Image_Processing_Jayaraman\Chapter5\lena.png');\n", +"x = rgb2gray(x);\n", +"y = double(x);\n", +"[m,n]= size(y);\n", +"L = max(max(x));\n", +"a = round(L/2);\n", +"b = L;\n", +"for i =1:m\n", +" for j =1:n\n", +" if(y(i,j)>=a & y(i,j)<=b)\n", +" z(i,j) = L;\n", +" else\n", +" z(i,j)=0;\n", +" end\n", +" end\n", +"end\n", +"z = uint8(z);\n", +"figure(1)\n", +"ShowImage(x,'Original Image');\n", +"title('Orginal Image')\n", +"figure(2)\n", +"ShowImage(z,'Gray Level Slicing');\n", +"title('Gray Level Slicing without preserving background')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5: Scilab_code_for_brightness_enhancement.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code for brightness enhancement \n", +"//Fig5.5\n", +"//page 246\n", +"clc;\n", +"close;\n", +"//a = imread('E:\DIP_JAYARAMAN\Chapter5\plate.GIF'); //SIVP toolbox\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter4\baboon.png');\n", +"a = rgb2gray(a);\n", +"b = double(a)+50;\n", +"b = uint8(b);\n", +"figure(1)\n", +"ShowImage(a,'Original Image'); \n", +"title('Original Image')\n", +"figure(2)\n", +"ShowImage(b,'Enhanced Image'); \n", +"title('Enhanced Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.7: Scilab_code_for_brightness_suppression.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code for brightness suppression\n", +"//Fig5.7\n", +"//page 247\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter4\baboon.png');\n", +"a = rgb2gray(a);\n", +"b = double(a)-50;\n", +"b = uint8(b);\n", +"figure(1)\n", +"ShowImage(a,'Original Image'); \n", +"title('Original Image')\n", +"figure(2)\n", +"ShowImage(b,'Brightness Supressed Image'); \n", +"title('Brightness Supressed Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.9: Scilab_code_for_Contrast_Manipulation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code for Contrast Manipulation\n", +"//Fig5.9\n", +"//page 248\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter4\lena.png');\n", +"a = rgb2gray(a);\n", +"b = double(a)*0.5;\n", +"b = uint8(b)\n", +"c = double(b)*2;\n", +"c = uint8(c)\n", +"figure(1)\n", +"ShowImage(a,'Original Image'); \n", +"title('Original Image')\n", +"figure(2)\n", +"ShowImage(b,'Decrease in Contrast'); \n", +"title('Decrease in Contrast')\n", +"figure(3)\n", +"ShowImage(c,'Increase in Contrast'); \n", +"title('Increase in Contrast')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/6-Image_Restoration_and_Denoising.ipynb b/Digital_Image_Processing_by_S_Jayaraman/6-Image_Restoration_and_Denoising.ipynb new file mode 100644 index 0000000..35834d9 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/6-Image_Restoration_and_Denoising.ipynb @@ -0,0 +1,512 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6: Image Restoration and Denoising" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.13: Scilab_code_to_perform_wiener_filtering_of_the_corrupted_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code to perform wiener filtering of the corrupted image\n", +"//Fig6.13\n", +"//Page 339\n", +"close;\n", +"clc;\n", +"x = imread('E:\DIP_JAYARAMAN\Chapter6\flower2.jpg'); //SIVP toolbox\n", +"x=double(rgb2gray(x));\n", +"sigma = 50;\n", +"Gamma = 1;\n", +"alpha = 1; // It indicates Wiener filter\n", +"[M N]=size(x);\n", +"h = zeros(M,N);\n", +"for i = 1:5\n", +" for j = 1:5\n", +" h(i,j) = 1/25;\n", +" end\n", +"end\n", +"Freqa = fft2d(x);\n", +"Freqh = fft2d(h);\n", +"y = real(ifft2d(Freqh.*Freqa)) //image degradation \n", +"y = y+25*rand(M,N,'normal'); //Adding random noise with normal distribution\n", +"Freqy = fft2d(y);\n", +"Powy = abs(Freqy).^2/(M*N);\n", +"sFreqh = Freqh.*(abs(Freqh)>0)+1/Gamma*(abs(Freqh)==0);\n", +"iFreqh = 1/sFreqh;\n", +"iFreqh = iFreqh'.*(abs(Freqh)*Gamma>1)+Gamma*abs(sFreqh)*iFreqh*(abs(sFreqh)*Gamma<=1);\n", +"iFreqh = iFreqh/(max(max(abs(iFreqh))));\n", +"Powy = Powy.*(Powy>sigma^2)+sigma^2*(Powy<=sigma^2);\n", +"Freqg = iFreqh.*(Powy-sigma^2)./(Powy-(1-alpha)*sigma^2);\n", +"ResFreqa = Freqg.*Freqy;\n", +"Resa = real(ifft2d(ResFreqa));\n", +"x = uint8(x);\n", +"y = uint8(y);\n", +"Resa = uint8(Resa);\n", +"ShowImage(x,'Original Image')\n", +"title('Original Image')\n", +"figure\n", +"ShowImage(y,'Degraded Image')\n", +"title('Degraded Image')\n", +"figure\n", +"ShowImage(Resa,'Restored Image')\n", +"title('Restored Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.18: Scilab_code_to_Perform_Average_Filtering_operation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code to Perform Average Filtering operation \n", +"//Fig6.18\n", +"//page 349\n", +"clc;\n", +"close;\n", +"a= imread('E:\DIP_JAYARAMAN\Chapter6\lenna.jpg');//SIVP toolbox\n", +"a=imnoise(a,'salt & pepper', 0.2); //Add salt&pepper noise tothe image \n", +"a=double(a);\n", +"[m n]=size(a);\n", +"N=input('enter the window size='); //The window size can be 3x3,5x5etc\n", +"Start=(N+1)/2;\n", +"Out_Imag=a;\n", +"for i=Start:(m-Start+1)\n", +"for j=Start:(n-Start+1)\n", +" limit=(N-1)/2;\n", +" Sum=0;\n", +" for k=-limit:limit,\n", +" for l=-limit:limit,\n", +" Sum=Sum+a(i+k,j+l);\n", +" end\n", +" end\n", +" Out_Imag(i,j)=Sum/(N*N);\n", +"end\n", +"end\n", +"a = uint8(a);\n", +"Out_Imag = uint8(Out_Imag);\n", +"ShowImage(a,'original Image')\n", +"title('Noisy Image')\n", +"figure\n", +"ShowImage(Out_Imag,'average filtered Image')\n", +"title('5x5 average filtered Image');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.1: Scilab_code_to_create_motion_blur.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code to create motion blur\n", +"//Fig6.1\n", +"//page 326\n", +"clc;\n", +"close;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter6\humm.jpg');//SIVP toolbox\n", +"//filter coefficients of fspecial('motion',10,25)\n", +"H =[0,0,0,0,0,0,0,0.0032,0.0449,0.0865,0.0072;...\n", +"0,0,0,0,0,0.0092,0.0509,0.0925,0.0629,0.0213,0;...\n", +"0,0,0,0.0152,0.0569,0.0985,0.0569,0.0152,0,0,0;...\n", +"0,0.0213,0.0629,0.0925,0.0509,0.0092,0,0,0,0,0;...\n", +"0.0072,0.0865,0.0449,0.0032,0,0,0,0,0,0,0];\n", +"Motion_Blur = imfilter(a,H);\n", +"Motion_Blur =uint8(Motion_Blur);\n", +"ShowImage(a,'original Image')\n", +"title('original Image')\n", +"figure\n", +"ShowImage(Motion_Blur,'Motion Blurred Image')\n", +"title('10x25 Motion Blurred Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.21: Scilab_code_to_Perform_median_filtering.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code to Perform median filtering\n", +"//Fig6.21\n", +"//page 352\n", +"clc;\n", +"close;\n", +"c = imread('E:\DIP_JAYARAMAN\Chapter6\cameraman.jpg');//SIVP toolbox\n", +"N = input('Enter the window size'); \n", +"a = double(imnoise(c,'salt & pepper',0.2));\n", +"[m,n] = size(a);\n", +"b = a;\n", +"if(modulo(N,2)==1)\n", +" Start = (N+1)/2;\n", +" End = Start;\n", +" limit1 = (N-1)/2;\n", +" limit2 = limit1;\n", +"else\n", +" Start = N/2;\n", +" End = Start+1;\n", +" limit1 = (N/2)-1;\n", +" limit2 = limit1+1;\n", +"end\n", +"for i = Start:(m-End+1)\n", +" for j = Start:(n-End+1)\n", +" I =1;\n", +" for k = -limit1:limit2\n", +" for l = -limit1:limit2\n", +" mat(I)= a(i+k,j+1)\n", +" I = I+1;\n", +" end\n", +" end\n", +" mat = gsort(mat);\n", +" if(modulo(N,2)==1)\n", +" b(i,j) = (mat(((N^2)+1)/2));\n", +" else\n", +" b(i,j) = (mat((N^2)/2)+mat(((N^2)/2)+1))/2;\n", +" end\n", +" end\n", +"end\n", +"a = uint8(a);\n", +"b = uint8(b);\n", +"figure\n", +"ShowImage(c,'Original Image') \n", +"title('Original Image')\n", +"figure\n", +"ShowImage(a,'noisy image') \n", +"title('noisy image')\n", +"figure\n", +"ShowImage(b,'Median Filtered Image')\n", +"title('5x5 Median Filtered Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.23: Scilab_code_to_Perform_median_filtering_of_colour_image.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code to Perform median filtering of colour image\n", +"//Fig6.23(a)\n", +"//page 353\n", +"clc;\n", +"close;\n", +"a=imread('E:\DIP_JAYARAMAN\Chapter6\peppers.png'); //SIVP toolbox\n", +"N=input('enter the window size');\n", +"b=imresize(a,[256,256]);\n", +"b=imnoise(b,'salt & pepper',.1);\n", +"[m n]=size(b);\n", +"R=b(:,:,1); \n", +"G=b(:,:,2);\n", +"B=b(:,:,3);\n", +"Out_R=Func_medianall(R,N);//Applying Median filter to ‘R’ plane\n", +"Out_G=Func_medianall(G,N);//Applying Median filter to ‘G’ plane\n", +"Out_B=Func_medianall(B,N);//Applying Median filter to ‘B’ plane\n", +"Out_Image(:,:,1)=Out_R;\n", +"Out_Image(:,:,2)=Out_G;\n", +"Out_Image(:,:,3)=Out_B;\n", +"b = uint8(b);\n", +"Out_Image = uint8(Out_Image);\n", +"//ShowColorImage(b,'noise added')\n", +"//title('noise added')\n", +"figure\n", +"ShowColorImage(Out_Image,'3x3 median filtered')\n", +"title('3x3 median filtered') " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.24: Scilab_code_to_Perform_Trimmed_Average_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code to Perform Trimmed Average Filter \n", +"//Alpha trimmed average filter\n", +"//Fig6.24\n", +"//page 355\n", +"clc;\n", +"close;\n", +"c = imread('E:\DIP_JAYARAMAN\Chapter6\lenna.jpg');//SIVP toolbox\n", +"s = 1; //s denotes the number of values to be left in the end\n", +"r = 1;\n", +"N = 9; //3x3 window\n", +"a = double(imnoise(c,'gaussian'));\n", +"[m,n] = size(a);\n", +"b = zeros(m,n);\n", +"for i= 2:m-1\n", +" for j = 2:n-1\n", +" mat = [a(i,j),a(i,j-1),a(i,j+1),a(i-1,j),a(i+1,j),a(i-1,j-1),...\n", +" a(i-1,j+1),a(i-1,j+1),a(i+1,j+1)];\n", +" sorted_mat = gsort(mat);\n", +" Sum=0;\n", +" for k=r+s:(N-s)\n", +" Sum = Sum+mat(k);\n", +" end\n", +" b(i,j)= Sum/(N-r-s);\n", +" end\n", +"end\n", +"a = uint8(a);\n", +"b = uint8(b);\n", +"//figure\n", +"//imshow(c) \n", +"//title('Original Image')\n", +"figure\n", +"ShowImage(a,'noisy image') \n", +"title('noisy image')\n", +"figure\n", +"ShowImage(b,'Trimmed Average Filtered Image')\n", +"title('Trimmed Average Filtered Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.5: Scilab_code_performs_inverse_filtering.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code performs inverse filtering \n", +"//Degrade the image by means of a known blur\n", +"//Apply inverse filter to the blurred image and see the restored image\n", +"//Fig6.5\n", +"//page 330\n", +"clc;\n", +"close;\n", +"x =imread('E:\DIP_JAYARAMAN\Chapter6\flower2.jpg');\n", +"x=double(rgb2gray(x));\n", +"[M N]=size(x);\n", +"h = zeros(M,N);\n", +"for i = 1:11\n", +" for j = 1:11\n", +" h(i,j) = 1/121;\n", +" end\n", +"end\n", +"sigma = sqrt(4*10^(-7));\n", +"freqx = fft2d(x); //Fourier transform of input image\n", +"freqh = fft2d(h);//Fourier transform of degradation\n", +"y = real(ifft2d(freqh.*freqx));\n", +"freqy = fft2d(y);\n", +"powfreqx = freqx.^2/(M*N);\n", +"alpha = 0.5; //Indicates inverse filter \n", +"freqg = ((freqh.')').*abs(powfreqx)./(abs(freqh.^2).*abs(powfreqx)+alpha*sigma^2);\n", +"Resfreqx = freqg.*freqy;\n", +"Resa = real(ifft2d(Resfreqx));\n", +"x = uint8(x);\n", +"y = uint8(y);\n", +"Resa = uint8(Resa)\n", +"ShowImage(x,'Original Image')\n", +"title('Original Image')\n", +"figure\n", +"ShowImage(y,'Degraded Image')\n", +"title('Degraded Image')\n", +"figure\n", +"ShowImage(Resa,'Restored Image')\n", +"title('Restored Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.7: Scilab_code_performs_inverse_filtering.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code performs inverse filtering \n", +"//Degrade the image by means of a known blur and white noise\n", +"//The image is degraded as well as corrupted by noise\n", +"//Apply inverse filter to restore the image\n", +"//Fig6.7\n", +"//page 332\n", +"clc;\n", +"close;\n", +"x =imread('E:\DIP_JAYARAMAN\Chapter6\flower2.jpg');\n", +"x=double(rgb2gray(x));\n", +"[M N]=size(x);\n", +"h = zeros(M,N);\n", +"for i = 1:11\n", +" for j = 1:11\n", +" h(i,j) = 1/121;\n", +" end\n", +"end\n", +"sigma = sqrt(4*10^(-7));\n", +"freqx = fft2d(x); //Fourier transform of input image\n", +"freqh = fft2d(h);//Fourier transform of degradation\n", +"y = real(ifft2d(freqh.*freqx))+10*rand(M,N,'normal');\n", +"freqy = fft2d(y);\n", +"powfreqx = freqx.^2/(M*N);\n", +"alpha = 0.5; //Indicates inverse filter \n", +"freqg = ((freqh.')').*abs(powfreqx)./(abs(freqh.^2).*abs(powfreqx)+alpha*sigma^2);\n", +"Resfreqx = freqg.*freqy;\n", +"Resa = real(ifft2d(Resfreqx));\n", +"x = uint8(x);\n", +"y = uint8(y);\n", +"Resa = uint8(Resa)\n", +"ShowImage(x,'Original Image')\n", +"title('Original Image')\n", +"figure\n", +"ShowImage(y,'Degraded+noise Image')\n", +"title('Degraded+noise Image')\n", +"figure\n", +"ShowImage(Resa,'Restored Image')\n", +"title('Restored Image')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.9: Scilab_code_performs_Pseudo_inverse_filtering.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Scilab code performs Pseudo inverse filtering \n", +"//Degrade the image by means of a known blur and white noise\n", +"//The image is degraded as well as corrupted by noise\n", +"//Apply Pseudo inverse filter to restore the image\n", +"//Fig6.9\n", +"//page 333\n", +"clc;\n", +"close;\n", +"x =imread('E:\DIP_JAYARAMAN\Chapter6\flower2.jpg');\n", +"x=double(rgb2gray(x));\n", +"[M N]=size(x);\n", +"h = zeros(M,N);\n", +"for i = 1:11\n", +" for j = 1:11\n", +" h(i,j) = 1/121;\n", +" end\n", +"end\n", +"mask_b = ones(11,11)/121;\n", +"[m1,n1] = size(mask_b);\n", +"Thr_Freq = 0.2;\n", +"freqx = fft2d(x); //Fourier transform of input image\n", +"freqh = fft2d(h);//Fourier transform of degradation\n", +"y = real(ifft2d(freqh.*freqx))+25*rand(M,N,'normal');\n", +"freqy = fft2d(y);\n", +"psf=zeros(M,N); \n", +"psf(M/2+1-(m1-1)/2:M/2+1+(m1-1)/2,N/2+1-(n1-1)/2:N/2+1+(n1-1)/2) = mask_b;\n", +"psf = fftshift(psf);\n", +"freq_res = fft2d(psf);\n", +"Inv_filt = freq_res./((abs(freq_res)).^2+Thr_Freq);\n", +"z = real(ifft2d(freqy.*Inv_filt));\n", +"x = uint8(x);\n", +"y = uint8(y);\n", +"z = uint8(z)\n", +"ShowImage(x,'Original Image')\n", +"title('Original Image')\n", +"figure\n", +"ShowImage(y,'Degraded+noise Image')\n", +"title('Degraded+noise Image')\n", +"figure\n", +"ShowImage(z,'Restored Image')\n", +"title('Restored Image')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/7-Image_Segmentation.ipynb b/Digital_Image_Processing_by_S_Jayaraman/7-Image_Segmentation.ipynb new file mode 100644 index 0000000..ccdb079 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/7-Image_Segmentation.ipynb @@ -0,0 +1,183 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7: Image Segmentation" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.23: Scilab_code_for_Differentiation_of_Gaussian_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code for Differentiation of Gaussian function\n", +"//Fig7.23\n", +"//page388\n", +"clc;\n", +"close;\n", +"sigma=input('Enter the value of sigma:')\n", +"i=-10:.1:10;\n", +"j=-10:.1:10;\n", +"r=sqrt(i.*i+j.*j);\n", +"y=(1/(sigma^2))*(((r.*r)/sigma^2)-1).*exp(-r.*r/2*sigma^2);\n", +"plot(i,y)\n", +"legend(sprintf('The sigma value is %g',sigma))\n", +"xtitle('Differentiation of Gaussian function')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.25: Scilab_code_for_Differentiation_of_Gaussian_Filter_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code for Differentiation of Gaussian Filter function\n", +"//Fig7.25\n", +"//page389\n", +"clc;\n", +"close;\n", +"sigma1 = input('Enter the value of sigma1:')\n", +"sigma2 = input('Enter the value of sigma2:')\n", +"i=-10:.1:10;\n", +"j=-10:.1:10;\n", +"r=sqrt(i.*i+j.*j);\n", +"y1 = (1/(sigma1^2))*(((r.*r)/sigma1^2)-1).*exp(-r.*r/2*sigma1^2);\n", +"y2 = (1/(sigma2^2))*(((r.*r)/sigma2^2)-1).*exp(-r.*r/2*sigma2^2);\n", +"y = y1-y2;\n", +"plot(i,y)\n", +"xtitle('Shape of DOG Filter')\n", +"//Result\n", +"//Enter the value of sigma1: 4\n", +"//Enter the value of sigma2: 1\n", +"// " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.27: Scilab_code_for_Edge_Detection_using_Different_Edge_detectors.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code for Edge Detection using Different Edge detectors \n", +"//[1]. Sobel [2].Prewitt [3].Log [4].Canny\n", +"//Fig7.27\n", +"//page389\n", +"close;\n", +"clc;\n", +"a = imread('E:\DIP_JAYARAMAN\Chapter7\sailing.jpg');\n", +"a = rgb2gray(a);\n", +"c = edge(a,'sobel');\n", +"d = edge(a,'prewitt');\n", +"e = edge(a,'log');\n", +"f = edge(a,'canny');\n", +"ShowImage(a,'Original Image')\n", +"title('Original Image')\n", +"figure\n", +"ShowImage(c,'Sobel')\n", +"title('Sobel')\n", +"figure\n", +"ShowImage(d,'Prewitt')\n", +"title('Prewitt')\n", +"figure\n", +"ShowImage(e,'Log')\n", +"title('Log')\n", +"figure\n", +"ShowImage(f,'Canny')\n", +"title('Canny')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.30: Scilab_code_to_perform_watershed_transform.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Scilab code to perform watershed transform\n", +"//Fig7.30\n", +"//Page396\n", +"clc;\n", +"close;\n", +"b = imread('E:\DIP_JAYARAMAN\Chapter7\teaset.png');\n", +"a = rgb2gray(b);\n", +"global EDGE_SOBEL;\n", +"Gradient = EdgeFilter(a, EDGE_SOBEL);\n", +"Threshold1 = CalculateOtsuThreshold(Gradient); // determine a threshold\n", +"EdgeImage = ~SegmentByThreshold(Gradient,Threshold1);\n", +"DistanceImage = DistanceTransform(EdgeImage);\n", +"Threshold2 = CalculateOtsuThreshold(DistanceImage) // determine a threshold\n", +"ThresholdImage = SegmentByThreshold(DistanceImage,Threshold2);\n", +"MarkerImage = SearchBlobs(ThresholdImage);\n", +"SegmentedImage = Watershed(Gradient,MarkerImage);\n", +"figure\n", +"ShowColorImage(b,'teaset')\n", +"title('teaset.png')\n", +"figure\n", +"ColorMapLength = length(unique(SegmentedImage));\n", +"ShowImage(SegmentedImage,'Result of Watershed Transform',jetcolormap(ColorMapLength)); " + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/8-Object_Recognition.ipynb b/Digital_Image_Processing_by_S_Jayaraman/8-Object_Recognition.ipynb new file mode 100644 index 0000000..d436e8a --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/8-Object_Recognition.ipynb @@ -0,0 +1,172 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: Object Recognition" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.4: To_verify_the_given_matrix_is_a_covaraince_matrix.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: To verify the given matrix is a covaraince matrix\n", +"//Problem 4\n", +"//page438\n", +"close;\n", +"clear;\n", +"clc;\n", +"K = [37,-15;-15,37];\n", +"evals = spec(K);\n", +"evals = gsort(evals);\n", +"disp(evals,'Eigen Values are =')\n", +"if (evals==abs(evals)) then\n", +" disp('Both the eigen values are non-negative and the given matrix is a covariance matrix');\n", +"else\n", +" disp('non-covariance matrix')\n", +"end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.5: To_compute_the_covariance_of_the_given_2D_data.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: To compute the covariance of the given 2D data\n", +"//Problem 5\n", +"//page439\n", +"close;\n", +"clear;\n", +"clc;\n", +"X1 = [2,1]';\n", +"X2 = [3,2]';\n", +"X3 = [2,3]';\n", +"X4 = [1,2]';\n", +"X = [X1,X2,X3,X4];\n", +"disp(X,'X=');\n", +"[M,N] = size(X); //M=rows, N = columns\n", +"for i =1:N\n", +" m(i) = mean(X(:,i));\n", +" A(:,i) = X(:,i)-m(i);\n", +"end\n", +"m = m';\n", +"disp(m,'mean =');\n", +"K = A'*A;\n", +"K = K/(M-1);\n", +"disp(K,'The Covaraince matix is K =')\n", +"//Result\n", +"//X= \n", +"// 2. 3. 2. 1. \n", +"// 1. 2. 3. 2. \n", +"//mean = \n", +"// 1.5 2.5 2.5 1.5 \n", +"// \n", +"//The Covaraince matix is K = \n", +"// 0.5 0.5 - 0.5 - 0.5 \n", +"// 0.5 0.5 - 0.5 - 0.5 \n", +"// - 0.5 - 0.5 0.5 0.5 \n", +"// - 0.5 - 0.5 0.5 0.5 " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.9: Develop_a_perceptron_AND_function_with_bipolar_inputs_and_targets.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Develop a perceptron AND function with bipolar inputs and targets\n", +"//Problem 9\n", +"//page441\n", +"close;\n", +"clear;\n", +"clc;\n", +"X1 = [1,-1,1,-1]; //X1 and X2 are input vectors to AND function\n", +"X2 = [1,1,-1,-1];\n", +"//b = [1,1,1,1]; //Biasing vector\n", +"T = [1,-1,-1,-1]; //Target vector for AND function\n", +"W1 = 0; //Weights are initialized \n", +"W2 = 0;\n", +"b = 0; //bias initialized \n", +"alpha = 1; //learning rate\n", +"for i = 1:length(X1)\n", +" Yin(i) = b+X1(i)*W1+X2(i)*W2;\n", +" if (Yin(i)>=1) \n", +" Y(i)=1;\n", +" elseif((Yin(i)<1)&(Yin(i)>=-1))\n", +" Y(i)=0;\n", +" elseif(Yin(i)<-1)\n", +" Y(i)=-1;\n", +" end\n", +" disp(Yin(i),'Yin=')\n", +" disp(Y(i),'Y=')\n", +" if(Y(i)~=T(i))\n", +" b = b+alpha*T(i);\n", +" W1 = W1+alpha*T(i)*X1(i);\n", +" W2 = W2+alpha*T(i)*X2(i);\n", +" disp(b,'b=')\n", +" disp(W1,'W1=')\n", +" disp(W2,'W2=')\n", +" end \n", +"end\n", +"disp('Final Weights after one iteration are')\n", +"disp(b,'Bias Weigth b=')\n", +"disp(W1,'W1=')\n", +"disp(W2,'W2=')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Digital_Image_Processing_by_S_Jayaraman/9-Image_Compression.ipynb b/Digital_Image_Processing_by_S_Jayaraman/9-Image_Compression.ipynb new file mode 100644 index 0000000..6d5e040 --- /dev/null +++ b/Digital_Image_Processing_by_S_Jayaraman/9-Image_Compression.ipynb @@ -0,0 +1,160 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9: Image Compression" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.59: Program_performs_Block_Truncation_Coding.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Program performs Block Truncation Coding(BTC) by choosing different \n", +"//block sizes\n", +"//Fig.9.59: MATLAB Example1\n", +"//page514\n", +"close;\n", +"clc;\n", +"x =imread('E:\Digital_Image_Processing_Jayaraman\Chapter9\lenna.jpg'); //SIVP toolbox\n", +"//x=imresize(x,[256 256]);\n", +"x1=x;\n", +"x=double(x);\n", +"[m1 n1]=size(x);\n", +"blk=input('Enter the block size:');\n", +"for i = 1 : blk : m1 \n", +"for j = 1 : blk : n1 \n", +" y = x(i:i+(blk-1),j:j+(blk-1)) ; \n", +" m = mean(mean(y)); \n", +" sig=std2(y);\n", +" b = y > m ; //the binary block \n", +" K = sum(sum(b)); \n", +" if (K ~= blk^2 ) & ( K ~= 0) \n", +" ml = m-sig*sqrt(K/((blk^2)-K)); \n", +" mu = m+sig*sqrt(((blk^2)-K)/K); \n", +" x(i:i+(blk-1), j:j+(blk-1)) = b*mu+(1- b)*ml; \n", +" end \n", +"end \n", +"end \n", +"//imshow(uint8(x))\n", +"//title('Reconstructed Image')\n", +"x = uint8(x);\n", +"figure(1)\n", +"imshow(x1)\n", +"title('Original Image'); //IPD toolbox\n", +"figure(2)\n", +"ShowImage(x, 'Reconstructed Image'); //IPD toolbox\n", +"title('Block Size = 8')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.9: Program_performs_Block_Truncation_Coding_BTC.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Program performs Block Truncation Coding(BTC) \n", +"//Example 9.9\n", +"//page512\n", +"close;\n", +"clear;\n", +"clc;\n", +"x = [65,75,80,70;72,75,82,68;84,72,62,65;66,68,72,80];\n", +"disp(x,'Original Block is x =')\n", +"[m1 n1]=size(x);\n", +"blk=input('Enter the block size:');\n", +"for i = 1 : blk : m1 \n", +"for j = 1 : blk : n1 \n", +" y = x(i:i+(blk-1),j:j+(blk-1)) ; \n", +" m = mean(mean(y)); \n", +" disp(m,'mean value is m =')\n", +" sig=std2(y);\n", +" disp(sig,'Standard deviation of the block is =')\n", +" b = y > m ; //the binary block \n", +" disp(b,'Binary allocation matrix is B=')\n", +" K = sum(sum(b)); \n", +" disp(K,'number of ones =')\n", +" if (K ~= blk^2 ) & ( K ~= 0) \n", +" ml = m-sig*sqrt(K/((blk^2)-K)); \n", +" disp(ml,'The value of a =')\n", +" mu = m+sig*sqrt(((blk^2)-K)/K); \n", +" disp(mu,'The value of b =')\n", +" x(i:i+(blk-1), j:j+(blk-1)) = b*mu+(1- b)*ml; \n", +" end \n", +"end \n", +"end \n", +"disp(round(x),'Reconstructed Block is x =')\n", +"//Result\n", +"//Original Block is x = \n", +"// \n", +"// 65. 75. 80. 70. \n", +"// 72. 75. 82. 68. \n", +"// 84. 72. 62. 65. \n", +"// 66. 68. 72. 80. \n", +"// \n", +"//Enter the block size:4\n", +"//mean value is m = 72.25 \n", +"//Standard deviation of the block is = 6.6282225 \n", +"//Binary allocation matrix is B= \n", +"// \n", +"// F T T F \n", +"// F T T F \n", +"// T F F F \n", +"// F F F T \n", +"// \n", +"//number of ones = 6\n", +"//The value of a = 67.115801 \n", +"//The value of b = 80.806998 \n", +"//Reconstructed Block is x = \n", +"// \n", +"// 67. 81. 81. 67. \n", +"// 67. 81. 81. 67. \n", +"// 81. 67. 67. 67. \n", +"// 67. 67. 67. 81. " + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |