{ "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)=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 }