SlideShare ist ein Scribd-Unternehmen logo
1 von 53
Digital Image Processing (DIP)
The Fundamentals - A MATLAB assisted non-mathematical approach




                                    By Abhishek Sharma (EEE 2k7)
Materials
   Some taken from slides by a NIT Surathkal friend : Varun
    Nagaraja. He worked in the same lab at IISc Bangalore. Joined as
    a PhD student in University of Maryland – College Park, a week
    back.

   Some material taken from online works of Sabih D. Khan, a
    French-Pakistani researcher.

   Some prepared by me! 
Objective


 To take a quasi non-mathematical , MATLAB assisted
  approach to DIP.
 I cut out the equations because…
1) I don’t want to scare you even before we start the climb
2) I am pathetic at elucidating maths concepts
3) I don’t have a lot of time.
4) You don’t need maths to start working in DIP.

   If I am able to make you fall in love with DIP, I hope like
    real world love, you will be able to accept it with its’
    shortcomings – maths!
SixthSense
     by Pranav Mistry, MIT Media
     Labs
   'SixthSense' is a wearable gestural interface that
    augments the physical world around us with digital
    information and lets us use natural hand gestures to
    interact with that information.

Image Processing - a definition



   Image Processing generally involves extraction of useful
    information from an image.
   This useful information may be the dimensions of an
    engineering component, size of diagnosed tumor, or
    even a 3D view of an unborn baby.
Intro to DIP with MATLAB

 Images can be conveniently represented as matrices in
  Matlab.
 One can open an image as a matrix using imread
  command.
 The matrix may simply be m x n form or it may be 3
  dimensional array or it may be an indexed
  matrix, depending upon image type.
 The image processing may be done simply by matrix
  calculation or matrix manipulation.
 Image may be displayed with imshow command.
 Changes to image may then be saved with imwrite
  command.
Image types

 Images may be of three types i.e. black & white, grey
  scale and colored.
 In Matlab, however, there are four types of images.
 Black & White images are called binary images,
  containing 1 for white and 0 for black.
 Grey scale images are called intensity images,
  containing numbers in the range of 0 to 255 or 0 to 1.
 Colored images may be represented as RGB Image or
  Indexed Image.
Image types

   In RGB Images there exist three indexed images.
   First image contains all the red portion of the
    image, second green and third contains the blue portion.
   So for a 640 x 480 sized image the matrix will be 640 x
    480 x 3.
   An alternate method of colored image representation is
    Indexed Image.
   It actually exist of two matrices namely image matrix
    and map matrix.
   Each color in the image is given an index number and in
    image matrix each color is represented as an index
    number.
   Map matrix contains the database of which index
    number belongs to which color.
MATLAB – image conversions

   RGB Image to Intensity Image        (rgb2gray)
   RGB Image to Indexed Image          (rgb2ind)
   RGB Image to Binary Image           (im2bw)
   Indexed Image to RGB Image          (ind2rgb)
   Indexed Image to Intensity Image    (ind2gray)
   Indexed Image to Binary Image       (im2bw)
   Intensity Image to Indexed Image    (gray2ind)
   Intensity Image to Binary Image     (im2bw)
   Intensity Image to RGB Image (gray2ind, ind2rgb)
Image Histograms

   There are a number of ways to get statistical information about
    data in the image.
   Image histogram is one such way.
   An image histogram is a chart that shows the distribution of
    intensities in an image.
   Each color level is represented as a point on x-axis and on y-
    axis is the number instances a color level repeats in the image.
   Histogram may be view with imhist command.
   Sometimes all the important information in an image lies only
    in a small region of colors, hence it usually is difficult to extract
    information out of that image.
   To balance the brightness level, we carry out an image
    processing operation termed histogram equalization. Use
    MATLAB histeq command
Some histogram experiments

   Read Bill Clinton’s image in your folder into MATLAB.
Simple character recognition
     code
   Detect only particular
    characters and numbers in an
    image.
   Characters are in white and of
    a fixed size.
   Background is black in color.
   The image is in binary format.

   We will explore various DIP
    concepts while we do this….
    Let’s start 
Let’s start with reading the image
Let’s have some fun… I know my
     sense of humor sucks!
   Now read the image ‘same color.jpg’ and display it on a window.
   Once the image is displayed in the window, select Tools –Data
    Cursor or select the shortcut on the toolbar.
   Click on point A as shown, on the image. It displays three values
    (RGB) since it is a color image. You can try reading pixel values for
    the previous image. It will be either 0/1 since it is binary image.
   Hold Alt and Click on point B. This creates something called as a
    new datatip.




Now for some fun
 What are the RGB values at the two points?
Morphological Operations

   These are image processing operations done on
    binary images based on certain morphologies or
    shapes.
   The value of each pixel in the output is based on the
    corresponding input pixel and its neighbors.
   By choosing appropriately shaped neighbors one can
    construct an operation that is sensitive to a certain
    shape in the input image.
Some basic morphological
operations
Skeletonize

   It creates skeleton of an object, by removing pixels on
    the boundaries but does not allow objects to break
    apart.
   It is an extremely important operation in image
    processing as it removes complexities from an image
    without loosing details.
Erosion and Dilation

 These are the most fundamental of binary
  morphological operations.
 In dilation if any pixel in the input pixel’s neighborhood
  is on, the output pixel is on otherwise off.
 In actual dilation grows the area of the object. Small
  holes in the object are removed.
 In erosion if every pixel in the input pixel’s
  neighborhood is on the output pixel is on otherwise off
 This in actual works as shrinking the object’s area, thus
  small isolated regions disappear.
Dilation….




Dilation does not necessarily mean dilation of the holes also. The
holes get contracted as shown above.
Also try image erosion. Use MATLAB’s help.
Dilation…

   adds pixels to the boundaries of objects in an image.
   number of pixels added from the objects in an image
    depends on the size and shape of the structuring
    element
   function strel(…)can be used to generate the SEs.
Structuring Elements
                   In mathematical morphology,
                   structuring element is a shape, used
                   to probe or interact with a given
                   image, with the purpose of drawing
                   conclusions on how this shape fits or
                   misses the shapes in the image.



                   Check out help on strel for various
                   combinations
Continuing with the algo…


   When the dilated image of the character is
   subtracted from the original we get something
   like…
   Next we create such images for all the
   characters that we want to recognize.
   (For all those individual character images in
   the folder)
Hit or miss?
   Function, bwhitmiss is employed to check if a particular
    character is present in the given image.
   bwhitmiss(BW1,SE1,SE2)performs the hit‐miss operation
    defined by the structuring elements SE1 and SE2. The
    hit‐miss operation preserves pixels whose neighborhoods
    match the shape of SE1 and don't match the shape of SE2.
   If the matrix returned by bwhitmiss contains nonzero
    elements, then the character is found in the image.




       Also note the use of functions isempty and nonzeros
       You can now use charrec.m to recognize few characters
       in a crude way.
Functions…again!
Finally! Let’s detect them….
Image Segmentation

   The goal of image segmentation is to cluster pixels
    into salient image regions, i.e., regions corresponding
    to individual surfaces, objects, or natural parts of
    objects.
   A segmentation could be used for object recognition,
    image compression, image editing, or image database
    look-up.
Image Segmentation
Image Segmentation - Global
  Thresholding
Disadvantage is when there are multiple colors for objects and
backgrounds.
Otsu’s Method

   Based on a very simple idea: Find the threshold that
    minimizes the weighted within-class variance.
   This turns out to be the same as maximizing the
    between-class variance.
   Operates directly on the gray level histogram [e.g.
    256 numbers, P(i)], so it’s fast (once the histogram is
    computed).
The weighted within-class variance is:

    (t)  q1 (t) (t)  q2 (t) (t)
      2
      w
                                2
                                1
                                                             2
                                                             2


Where the class probabilities are estimated as:
                t                                      I

   q1 (t)   P(i)                    q2 (t)       P(i)
                                                  i  t 1
               i 1


And the class means are given by:


                                                   I
                t
                iP(i)                                iP(i)
  1 (t)                          2 (t)  
           i 1 q1 (t)                       i t 1 q2 (t )
Binarization - NiBlack Algo
Connected Components
The code….
This was again a very crude way, since we are depending
only on value of area which might not remain constant if
camera changes position.
Most of the times the standard features available with
regionprops() is not sufficient. We will have to write our
own code to extract features.
Also we used hard thresholds for are as to classify CCs.
Again most of the times, this is not followed. Classifiers
using Pattern Recognition techniques are employed.
Why edges?
         Reduce dimensionality of data

         Preserve content information

         Useful in applications such as:
          ◦ object detection
          ◦ structure from motion
          ◦ tracking
Why not edges?
      But, sometimes not that useful, why?

      Difficulties:
          1. Modeling assumptions
          2. Parameters
          3. Multiple sources of information
             (brightness, color, texture, …)
          4. Real world conditions


      Is edge detection even well defined?
Road detection
Canny edge detection

         1. smooth


                     2. gradient



                                   3. thresh, suppress, link




Canny is optimal w.r.t.
some model.
Canny edge detection

       1. smooth


                   2. gradient



                                 3. thresh, suppress, link




And yet…
Canny difficulties
1. Modeling assumptions
   Step edges, junctions, etc.


2. Parameters
   Scales, threshold, etc.


3. Multiple sources of information
   Only handles brightness


4. Real world conditions
   Gaussian iid noise? Texture…
Edge Detection

   Edge detection extract edges of objects from an image.
   There are a number of algorithms for this, but these
    may be classified as derivative based or gradient based.
   In derivative based edge detection the algorithm takes
    first or second derivative on each pixel in the image.
   In case of first derivative at the edge of the image there
    is a rapid change of intensity.
   While in case of second derivative there is a zero pixel
    value, termed zero crossing.
   In gradient based edge detection a gradient of
    consecutive pixels is taken in x and y direction.
   Taking derivative on each and every pixel of the image
    consumes a lot of computer resources and hence is not
    practical.
   So usually an operation called kernel operation is
    carried out.
   A kernel is a small matrix sliding over the image matrix
    containing coefficients which are multiplied to
    corresponding image matrix elements and their sum is
    put at the target pixel.
Sobel’s Method
Prewitt’s Method
Best one is – Canny’s Method

 Uses both the derivative and the gradient to perform
  edge detection
 The maths is a bit complex
 Can through the PDF in your folder later.
 Pass ‘canny’ as a parameter to the edge function to
  perform canny.

Weitere ähnliche Inhalte

Was ist angesagt?

Automatic vehicle license plate detection using VEDA
Automatic vehicle license plate detection using VEDAAutomatic vehicle license plate detection using VEDA
Automatic vehicle license plate detection using VEDARojith Thomas
 
Character recognition from number plate written in assamese language
Character recognition from number plate written in assamese languageCharacter recognition from number plate written in assamese language
Character recognition from number plate written in assamese languageSubhash Basistha
 
License Plate Recognition
License Plate RecognitionLicense Plate Recognition
License Plate RecognitionAmr Rashed
 
Automatic License Plate Recognition [ALPR]-A Review Paper
Automatic License Plate Recognition [ALPR]-A Review PaperAutomatic License Plate Recognition [ALPR]-A Review Paper
Automatic License Plate Recognition [ALPR]-A Review PaperIRJET Journal
 
Paper id 25201447
Paper id 25201447Paper id 25201447
Paper id 25201447IJRAT
 
Number plate recognition system using matlab.
Number plate recognition system using matlab.Number plate recognition system using matlab.
Number plate recognition system using matlab.Namra Afzal
 
Optical Character Recognition
Optical Character RecognitionOptical Character Recognition
Optical Character Recognitionaavi241
 
An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...
An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...
An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...IJMTST Journal
 
A design of license plate recognition system using convolutional neural network
A design of license plate recognition system using convolutional neural networkA design of license plate recognition system using convolutional neural network
A design of license plate recognition system using convolutional neural networkIJECEIAES
 
Bangla Optical Digits Recognition using Edge Detection Method
Bangla Optical Digits Recognition using Edge Detection MethodBangla Optical Digits Recognition using Edge Detection Method
Bangla Optical Digits Recognition using Edge Detection MethodIOSR Journals
 
License Plate Recognition
License Plate RecognitionLicense Plate Recognition
License Plate RecognitionGilbert
 
IRJET - Automatic Licence Plate Detection and Recognition
IRJET -  	  Automatic Licence Plate Detection and RecognitionIRJET -  	  Automatic Licence Plate Detection and Recognition
IRJET - Automatic Licence Plate Detection and RecognitionIRJET Journal
 
Number plate recognition using matlab
Number plate recognition using matlabNumber plate recognition using matlab
Number plate recognition using matlabAbhishek Sainkar
 
Automatic number plate recognition using matlab
Automatic number plate recognition using matlabAutomatic number plate recognition using matlab
Automatic number plate recognition using matlabChetanSingh134
 
Final Thesis Presentation Licenseplaterecognitionincomplexscenes
Final Thesis Presentation LicenseplaterecognitionincomplexscenesFinal Thesis Presentation Licenseplaterecognitionincomplexscenes
Final Thesis Presentation Licenseplaterecognitionincomplexscenesdswazalwar
 

Was ist angesagt? (20)

License Plate recognition
License Plate recognitionLicense Plate recognition
License Plate recognition
 
License plate recognition.
License plate recognition.License plate recognition.
License plate recognition.
 
Ay36304310
Ay36304310Ay36304310
Ay36304310
 
Automatic vehicle license plate detection using VEDA
Automatic vehicle license plate detection using VEDAAutomatic vehicle license plate detection using VEDA
Automatic vehicle license plate detection using VEDA
 
Character recognition from number plate written in assamese language
Character recognition from number plate written in assamese languageCharacter recognition from number plate written in assamese language
Character recognition from number plate written in assamese language
 
License Plate Recognition
License Plate RecognitionLicense Plate Recognition
License Plate Recognition
 
Automatic License Plate Recognition [ALPR]-A Review Paper
Automatic License Plate Recognition [ALPR]-A Review PaperAutomatic License Plate Recognition [ALPR]-A Review Paper
Automatic License Plate Recognition [ALPR]-A Review Paper
 
Fpga human detection
Fpga human detectionFpga human detection
Fpga human detection
 
Paper id 25201447
Paper id 25201447Paper id 25201447
Paper id 25201447
 
Number plate recognition system using matlab.
Number plate recognition system using matlab.Number plate recognition system using matlab.
Number plate recognition system using matlab.
 
Optical Character Recognition
Optical Character RecognitionOptical Character Recognition
Optical Character Recognition
 
An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...
An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...
An Efficient Model to Identify A Vehicle by Recognizing the Alphanumeric Char...
 
A design of license plate recognition system using convolutional neural network
A design of license plate recognition system using convolutional neural networkA design of license plate recognition system using convolutional neural network
A design of license plate recognition system using convolutional neural network
 
Bangla Optical Digits Recognition using Edge Detection Method
Bangla Optical Digits Recognition using Edge Detection MethodBangla Optical Digits Recognition using Edge Detection Method
Bangla Optical Digits Recognition using Edge Detection Method
 
License Plate Recognition
License Plate RecognitionLicense Plate Recognition
License Plate Recognition
 
IRJET - Automatic Licence Plate Detection and Recognition
IRJET -  	  Automatic Licence Plate Detection and RecognitionIRJET -  	  Automatic Licence Plate Detection and Recognition
IRJET - Automatic Licence Plate Detection and Recognition
 
journal nakk
journal nakkjournal nakk
journal nakk
 
Number plate recognition using matlab
Number plate recognition using matlabNumber plate recognition using matlab
Number plate recognition using matlab
 
Automatic number plate recognition using matlab
Automatic number plate recognition using matlabAutomatic number plate recognition using matlab
Automatic number plate recognition using matlab
 
Final Thesis Presentation Licenseplaterecognitionincomplexscenes
Final Thesis Presentation LicenseplaterecognitionincomplexscenesFinal Thesis Presentation Licenseplaterecognitionincomplexscenes
Final Thesis Presentation Licenseplaterecognitionincomplexscenes
 

Andere mochten auch

05 histogram processing DIP
05 histogram processing DIP05 histogram processing DIP
05 histogram processing DIPbabak danyal
 
Digital Image Processing Fundamental
Digital Image Processing FundamentalDigital Image Processing Fundamental
Digital Image Processing FundamentalThuong Nguyen Canh
 
Breast Lesion Segmentation in Ultrasound Images
Breast Lesion Segmentation in Ultrasound ImagesBreast Lesion Segmentation in Ultrasound Images
Breast Lesion Segmentation in Ultrasound ImagesMohamed Elawady
 
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...Hemantha Kulathilake
 
various methods for image segmentation
various methods for image segmentationvarious methods for image segmentation
various methods for image segmentationRaveesh Methi
 
Bit plane slicing
Bit plane slicingBit plane slicing
Bit plane slicingAsad Ali
 
Smoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainSmoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainMadhu Bala
 
Image segmentation
Image segmentationImage segmentation
Image segmentationDeepak Kumar
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domainAshish Kumar
 
BRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSING
BRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSINGBRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSING
BRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSINGDharshika Shreeganesh
 
Digital image processing using matlab
Digital image processing using matlab Digital image processing using matlab
Digital image processing using matlab Amr Rashed
 
Image proceesing with matlab
Image proceesing with matlabImage proceesing with matlab
Image proceesing with matlabAshutosh Shahi
 

Andere mochten auch (20)

05 histogram processing DIP
05 histogram processing DIP05 histogram processing DIP
05 histogram processing DIP
 
Digital Image Processing Fundamental
Digital Image Processing FundamentalDigital Image Processing Fundamental
Digital Image Processing Fundamental
 
Im seg04
Im seg04Im seg04
Im seg04
 
Breast Lesion Segmentation in Ultrasound Images
Breast Lesion Segmentation in Ultrasound ImagesBreast Lesion Segmentation in Ultrasound Images
Breast Lesion Segmentation in Ultrasound Images
 
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
 
Research methodology
Research methodologyResearch methodology
Research methodology
 
various methods for image segmentation
various methods for image segmentationvarious methods for image segmentation
various methods for image segmentation
 
Bit plane slicing
Bit plane slicingBit plane slicing
Bit plane slicing
 
Smoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainSmoothing Filters in Spatial Domain
Smoothing Filters in Spatial Domain
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
Unit3 dip
Unit3 dipUnit3 dip
Unit3 dip
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Segmentation
SegmentationSegmentation
Segmentation
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domain
 
BRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSING
BRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSINGBRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSING
BRAIN TUMOR MRI IMAGE SEGMENTATION AND DETECTION IN IMAGE PROCESSING
 
basic research mcqs
basic research mcqsbasic research mcqs
basic research mcqs
 
Digital image processing using matlab
Digital image processing using matlab Digital image processing using matlab
Digital image processing using matlab
 
Image proceesing with matlab
Image proceesing with matlabImage proceesing with matlab
Image proceesing with matlab
 
SOLAR INVERTER
SOLAR INVERTER SOLAR INVERTER
SOLAR INVERTER
 
IMAGE SEGMENTATION.
IMAGE SEGMENTATION.IMAGE SEGMENTATION.
IMAGE SEGMENTATION.
 

Ähnlich wie Dip day1&2

Dip digital image 3
Dip digital image 3Dip digital image 3
Dip digital image 3Shajun Nisha
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)Hasitha Ediriweera
 
Programming in matlab lesson5
Programming in matlab lesson5Programming in matlab lesson5
Programming in matlab lesson5najmah17
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlabminhtaispkt
 
Performance Anaysis for Imaging System
Performance Anaysis for Imaging SystemPerformance Anaysis for Imaging System
Performance Anaysis for Imaging SystemVrushali Lanjewar
 
Data Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingData Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingDerek Kane
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptxAvinashJain66
 
Matlab intro
Matlab introMatlab intro
Matlab introfvijayami
 
Image processing using matlab
Image processing using matlabImage processing using matlab
Image processing using matlabdedik dafiyanto
 
computervision1.pdf it is about computer vision
computervision1.pdf it is about computer visioncomputervision1.pdf it is about computer vision
computervision1.pdf it is about computer visionshesnasuneer
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingAnkur Nanda
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialpotaters
 
19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptx
19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptx19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptx
19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptxSamridhGarg
 
Basics of Image Processing using MATLAB
Basics of Image Processing using MATLABBasics of Image Processing using MATLAB
Basics of Image Processing using MATLABvkn13
 

Ähnlich wie Dip day1&2 (20)

Dip digital image 3
Dip digital image 3Dip digital image 3
Dip digital image 3
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)
 
Programming in matlab lesson5
Programming in matlab lesson5Programming in matlab lesson5
Programming in matlab lesson5
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
Performance Anaysis for Imaging System
Performance Anaysis for Imaging SystemPerformance Anaysis for Imaging System
Performance Anaysis for Imaging System
 
mini prjt
mini prjtmini prjt
mini prjt
 
Data Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingData Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image Processing
 
Report
ReportReport
Report
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
Matlab dip
Matlab dipMatlab dip
Matlab dip
 
Image processing using matlab
Image processing using matlabImage processing using matlab
Image processing using matlab
 
computervision1.pdf it is about computer vision
computervision1.pdf it is about computer visioncomputervision1.pdf it is about computer vision
computervision1.pdf it is about computer vision
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorial
 
19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptx
19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptx19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptx
19BCS1815_PresentationAutomatic Number Plate Recognition(ANPR)P.pptx
 
ImSeg04.ppt
ImSeg04.pptImSeg04.ppt
ImSeg04.ppt
 
ImSeg04 (2).ppt
ImSeg04 (2).pptImSeg04 (2).ppt
ImSeg04 (2).ppt
 
Basics of Image Processing using MATLAB
Basics of Image Processing using MATLABBasics of Image Processing using MATLAB
Basics of Image Processing using MATLAB
 
Log polar coordinates
Log polar coordinatesLog polar coordinates
Log polar coordinates
 

Kürzlich hochgeladen

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 

Kürzlich hochgeladen (20)

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 

Dip day1&2

  • 1. Digital Image Processing (DIP) The Fundamentals - A MATLAB assisted non-mathematical approach By Abhishek Sharma (EEE 2k7)
  • 2. Materials  Some taken from slides by a NIT Surathkal friend : Varun Nagaraja. He worked in the same lab at IISc Bangalore. Joined as a PhD student in University of Maryland – College Park, a week back.  Some material taken from online works of Sabih D. Khan, a French-Pakistani researcher.  Some prepared by me! 
  • 3. Objective  To take a quasi non-mathematical , MATLAB assisted approach to DIP.  I cut out the equations because… 1) I don’t want to scare you even before we start the climb 2) I am pathetic at elucidating maths concepts 3) I don’t have a lot of time. 4) You don’t need maths to start working in DIP.  If I am able to make you fall in love with DIP, I hope like real world love, you will be able to accept it with its’ shortcomings – maths!
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. SixthSense by Pranav Mistry, MIT Media Labs  'SixthSense' is a wearable gestural interface that augments the physical world around us with digital information and lets us use natural hand gestures to interact with that information. 
  • 9.
  • 10. Image Processing - a definition  Image Processing generally involves extraction of useful information from an image.  This useful information may be the dimensions of an engineering component, size of diagnosed tumor, or even a 3D view of an unborn baby.
  • 11. Intro to DIP with MATLAB  Images can be conveniently represented as matrices in Matlab.  One can open an image as a matrix using imread command.  The matrix may simply be m x n form or it may be 3 dimensional array or it may be an indexed matrix, depending upon image type.  The image processing may be done simply by matrix calculation or matrix manipulation.  Image may be displayed with imshow command.  Changes to image may then be saved with imwrite command.
  • 12. Image types  Images may be of three types i.e. black & white, grey scale and colored.  In Matlab, however, there are four types of images.  Black & White images are called binary images, containing 1 for white and 0 for black.  Grey scale images are called intensity images, containing numbers in the range of 0 to 255 or 0 to 1.  Colored images may be represented as RGB Image or Indexed Image.
  • 13. Image types  In RGB Images there exist three indexed images.  First image contains all the red portion of the image, second green and third contains the blue portion.  So for a 640 x 480 sized image the matrix will be 640 x 480 x 3.  An alternate method of colored image representation is Indexed Image.  It actually exist of two matrices namely image matrix and map matrix.  Each color in the image is given an index number and in image matrix each color is represented as an index number.  Map matrix contains the database of which index number belongs to which color.
  • 14. MATLAB – image conversions  RGB Image to Intensity Image (rgb2gray)  RGB Image to Indexed Image (rgb2ind)  RGB Image to Binary Image (im2bw)  Indexed Image to RGB Image (ind2rgb)  Indexed Image to Intensity Image (ind2gray)  Indexed Image to Binary Image (im2bw)  Intensity Image to Indexed Image (gray2ind)  Intensity Image to Binary Image (im2bw)  Intensity Image to RGB Image (gray2ind, ind2rgb)
  • 15. Image Histograms  There are a number of ways to get statistical information about data in the image.  Image histogram is one such way.  An image histogram is a chart that shows the distribution of intensities in an image.  Each color level is represented as a point on x-axis and on y- axis is the number instances a color level repeats in the image.  Histogram may be view with imhist command.  Sometimes all the important information in an image lies only in a small region of colors, hence it usually is difficult to extract information out of that image.  To balance the brightness level, we carry out an image processing operation termed histogram equalization. Use MATLAB histeq command
  • 16. Some histogram experiments  Read Bill Clinton’s image in your folder into MATLAB.
  • 17. Simple character recognition code  Detect only particular characters and numbers in an image.  Characters are in white and of a fixed size.  Background is black in color.  The image is in binary format.  We will explore various DIP concepts while we do this…. Let’s start 
  • 18. Let’s start with reading the image
  • 19. Let’s have some fun… I know my sense of humor sucks!  Now read the image ‘same color.jpg’ and display it on a window.  Once the image is displayed in the window, select Tools –Data Cursor or select the shortcut on the toolbar.  Click on point A as shown, on the image. It displays three values (RGB) since it is a color image. You can try reading pixel values for the previous image. It will be either 0/1 since it is binary image.  Hold Alt and Click on point B. This creates something called as a new datatip. Now for some fun  What are the RGB values at the two points?
  • 20. Morphological Operations  These are image processing operations done on binary images based on certain morphologies or shapes.  The value of each pixel in the output is based on the corresponding input pixel and its neighbors.  By choosing appropriately shaped neighbors one can construct an operation that is sensitive to a certain shape in the input image.
  • 22. Skeletonize  It creates skeleton of an object, by removing pixels on the boundaries but does not allow objects to break apart.  It is an extremely important operation in image processing as it removes complexities from an image without loosing details.
  • 23. Erosion and Dilation  These are the most fundamental of binary morphological operations.  In dilation if any pixel in the input pixel’s neighborhood is on, the output pixel is on otherwise off.  In actual dilation grows the area of the object. Small holes in the object are removed.  In erosion if every pixel in the input pixel’s neighborhood is on the output pixel is on otherwise off  This in actual works as shrinking the object’s area, thus small isolated regions disappear.
  • 24. Dilation…. Dilation does not necessarily mean dilation of the holes also. The holes get contracted as shown above. Also try image erosion. Use MATLAB’s help.
  • 25. Dilation…  adds pixels to the boundaries of objects in an image.  number of pixels added from the objects in an image depends on the size and shape of the structuring element  function strel(…)can be used to generate the SEs.
  • 26. Structuring Elements In mathematical morphology, structuring element is a shape, used to probe or interact with a given image, with the purpose of drawing conclusions on how this shape fits or misses the shapes in the image. Check out help on strel for various combinations
  • 27. Continuing with the algo… When the dilated image of the character is subtracted from the original we get something like… Next we create such images for all the characters that we want to recognize. (For all those individual character images in the folder)
  • 28. Hit or miss?  Function, bwhitmiss is employed to check if a particular character is present in the given image.  bwhitmiss(BW1,SE1,SE2)performs the hit‐miss operation defined by the structuring elements SE1 and SE2. The hit‐miss operation preserves pixels whose neighborhoods match the shape of SE1 and don't match the shape of SE2.  If the matrix returned by bwhitmiss contains nonzero elements, then the character is found in the image. Also note the use of functions isempty and nonzeros You can now use charrec.m to recognize few characters in a crude way.
  • 31. Image Segmentation  The goal of image segmentation is to cluster pixels into salient image regions, i.e., regions corresponding to individual surfaces, objects, or natural parts of objects.  A segmentation could be used for object recognition, image compression, image editing, or image database look-up.
  • 32.
  • 34. Image Segmentation - Global Thresholding Disadvantage is when there are multiple colors for objects and backgrounds.
  • 35. Otsu’s Method  Based on a very simple idea: Find the threshold that minimizes the weighted within-class variance.  This turns out to be the same as maximizing the between-class variance.  Operates directly on the gray level histogram [e.g. 256 numbers, P(i)], so it’s fast (once the histogram is computed).
  • 36. The weighted within-class variance is:  (t)  q1 (t) (t)  q2 (t) (t) 2 w 2 1 2 2 Where the class probabilities are estimated as: t I q1 (t)   P(i) q2 (t)   P(i) i  t 1 i 1 And the class means are given by: I t iP(i) iP(i) 1 (t)   2 (t)   i 1 q1 (t) i t 1 q2 (t )
  • 38.
  • 41. This was again a very crude way, since we are depending only on value of area which might not remain constant if camera changes position. Most of the times the standard features available with regionprops() is not sufficient. We will have to write our own code to extract features. Also we used hard thresholds for are as to classify CCs. Again most of the times, this is not followed. Classifiers using Pattern Recognition techniques are employed.
  • 42. Why edges?  Reduce dimensionality of data  Preserve content information  Useful in applications such as: ◦ object detection ◦ structure from motion ◦ tracking
  • 43. Why not edges? But, sometimes not that useful, why? Difficulties: 1. Modeling assumptions 2. Parameters 3. Multiple sources of information (brightness, color, texture, …) 4. Real world conditions Is edge detection even well defined?
  • 45. Canny edge detection 1. smooth 2. gradient 3. thresh, suppress, link Canny is optimal w.r.t. some model.
  • 46. Canny edge detection 1. smooth 2. gradient 3. thresh, suppress, link And yet…
  • 47. Canny difficulties 1. Modeling assumptions Step edges, junctions, etc. 2. Parameters Scales, threshold, etc. 3. Multiple sources of information Only handles brightness 4. Real world conditions Gaussian iid noise? Texture…
  • 48. Edge Detection  Edge detection extract edges of objects from an image.  There are a number of algorithms for this, but these may be classified as derivative based or gradient based.  In derivative based edge detection the algorithm takes first or second derivative on each pixel in the image.  In case of first derivative at the edge of the image there is a rapid change of intensity.  While in case of second derivative there is a zero pixel value, termed zero crossing.  In gradient based edge detection a gradient of consecutive pixels is taken in x and y direction.
  • 49.
  • 50. Taking derivative on each and every pixel of the image consumes a lot of computer resources and hence is not practical.  So usually an operation called kernel operation is carried out.  A kernel is a small matrix sliding over the image matrix containing coefficients which are multiplied to corresponding image matrix elements and their sum is put at the target pixel.
  • 53. Best one is – Canny’s Method  Uses both the derivative and the gradient to perform edge detection  The maths is a bit complex  Can through the PDF in your folder later.  Pass ‘canny’ as a parameter to the edge function to perform canny.