Computer Vision
Lecture II
Digital Image Processing Review
 By: Dr. Omar Ahmad
Lecture Contents
●   Images as 2D signals.
●   What are digital images?
●
    CCD sensors and Color filters for Colored Images.
●   Images as 2D arrays in Matlab and OpenCv
●   Displaying Images.
●   Cropping images
●   Adding images
●   Blending Images
●   OpenCv basics
What is an image?
●   An image can be thought of as a 2D function.
                           I(x,y)
                                                   3
What is an image?
●   Plotting the 2D image function in Matlab as a surface.
                                                             4
What is an image?
●   What if we smooth the function?
                                      We observe that the
                                      sharp peaks have
                                      been smoothed out.
                                      What will
                                      happen to
                                      the image?
                                                            5
What is an image?
●   We will get a 'Blurred' image.
                                     6
What is an image?
●   So images can be thought of as
    –   A 2D array of numbers ranging from some minimum to
        some maximum value
    –   A function I of x and y, I(x,y)
    –   Something captured using a camera !!
                                                             7
What are digital images?
                           8
What are digital images?
●   Each image is made up of small discrete units known as
    pixels (stands for Picture Elements)
                                                             9
What are digital images?
●   Capturing a colored image using a Bayer filter mechanism
                                                           10
What are digital images?
                           11
What are digital images?
●   So now we can think of digital images as 2D functions
    –   I(x,y) such that
        ●x ranges from [a,b] and y ranges from[c,d]
      ● The intensity also ranges from [min,max]
●   Why do intensities vary from 0 to 255?
●   It is better (makes more sense) to have intensity range from
    [0,1] instead.
●   Colored images can also be thought of in the same way.
    –   I(x,y) = [ r(x,y), g(x,y), b(x,y)] T
                                                                   12
What are digital images?
●   Can you define this image as a function?
                                               13
What are images?
●   A small grid from the image will look like this.
         Be careful about Rows and Columns vs x and y !!
                                                           14
What is quantization?
   Example: Round off to a whole number where you use a floor() function.
                       3.2    1.7     5.4     3.8     3.7
                       3.1    1.6     5.3     3.9     3.5
                       2.8    1.8     5.2     3.9     3.6
                                                                            15
Using Matlab for Image Processing
my_color_img = imread('ColoredChalk.jpg');
img_green = my_color_img(:,:,3);
imshow(my_color_img);
figure();
imshow(img_green);
                                             16
Using Matlab for Image Processing
●   What size is my image?
    –   Use size(img) function
●   What is the class of my image?
    –   Use the class(img) command
                                     17