lecture 5 dr roger s gaborski
Download
Skip this Video
Download Presentation
Fundamentals of Computer Vision

Loading in 2 Seconds...

play fullscreen
1 / 53

Fundamentals of Computer Vision - PowerPoint PPT Presentation


  • 132 Views
  • Uploaded on

Lecture 5 Dr. Roger S. Gaborski. Fundamentals of Computer Vision. Quiz 1. In Class Exercise. Intensity image is simply a matrix of numbers. We can summary this information by only retaining the distribution if gray level values:. PARTIAL IMAGE INFO:.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Fundamentals of Computer Vision' - ulric


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
lecture 5 dr roger s gaborski
Lecture 5

Dr. Roger S. Gaborski

Fundamentals of Computer Vision

Roger S. Gaborski

quiz 1
Quiz 1

Roger S. Gaborski

in class exercise
In Class Exercise

Roger S. Gaborski

slide4
Intensity image is simply

a matrix of numbers

We can summary this information

by only retaining the distribution

if gray level values:

PARTIAL IMAGE INFO:

117 83 59 59 68 77 84

94 82 67 62 70 83 86

85 81 71 65 77 89 86

82 76 67 72 90 97 86

66 54 68 104 121 107 85

46 58 89 138 165 137 91

38 80 147 200 211 187 138

40 80 149 197 202 187 146

56 76 114 159 181 160 113

An image shows the spatial

distribution of gray level values

Roger S. Gaborski

image histogram
Image Histogram

Plot of Pixel Count as a Function of Gray Level Value

Pixel

Count

Gray Level Value

Roger S. Gaborski

histogram
Histogram
  • Histogram consists of
    • Peaks: high concentration of gray level values
    • Valleys: low concentration
    • Flat regions

Roger S. Gaborski

formally image histograms
Formally, Image Histograms

Histogram:

  • Digital image
  • L possible intensity levels in range [0,G]
  • Defined: h(rk) = nk
    • Where rk is the kth intensity level in the interval [0,G] and nk is the number of pixels in the image whose level is rk .
    • G: uint8 255

uint16 65535

double 1.0

Roger S. Gaborski

notation
Notation
  • L levels in range [0, G]
  • For example:
    • 0, 1, 2, 3, 4, in this case G = 4, L = 5
    • Since we cannot have an index of zero,
      • In this example, index of:

Index 1 maps to gray level 0

2 maps to 1

3 maps to 2

4 maps to 3

5 maps to 4

Roger S. Gaborski

normalized histogram
Normalized Histogram
  • Normalized histogram is obtained by dividing elements of h(rk) by the total number of pixels in the image (n):

fork = 1, 2,…, L

p(rk) is an estimate of the probability of occurrence of intensity level rk

Roger S. Gaborski

matlab histogram
MATLAB Histogram
  • h = imhist( f, b )
    • h is the histogram, h(rk)
    • f is the input image
    • b is the number of bins (default is 256)
  • Normalized histogram

Roger S. Gaborski

background gray image
Background: Gray Image

>> I = imread('Flags.jpg');

>> figure, imshow(I) % uint8

>> Im= im2double(I); % convert to double

>> Igray = (Im(:,:,1)+Im(:,:,2)+Im(:,:,3))/3;

>> figure, imshow(Igray)

There is also the rgb2gray function that results

in a slightly different image

Roger S. Gaborski

gray scale histogram
Gray Scale Histogram

Roger S. Gaborski

plots
Plots
  • bar(horz, v, width)
    • v is row vector
      • points to be plotted
    • horz is a vector same dimension as v
      • increments of horizontal scale
      • omitted  axis divided in units 0 to length(v)
    • width number in [0 1]
      • 1 bars touch
      • 0 vertical lines
      • 0.8 default

Roger S. Gaborski

slide15
p= imhist(Igray)/numel(Igray);

>> h1 = p(1:10:256);

>> horz = (1:10:256);

>> figure, bar(horz,h1)

Review other examples

in text and in MATLAB

documentation

Roger S. Gaborski

slide16
Chapter 3

www.prenhall.com/gonzalezwoodseddins

Roger S. Gaborski

gray scale histogram1
Gray Scale Histogram

Roger S. Gaborski

normalized gray scale histogram
Normalized Gray Scale Histogram

>> p= imhist(Igray)/numel(Igray);

>> figure, plot(p)

Roger S. Gaborski

normalized gray scale histogram1
Normalized Gray Scale Histogram

256 bins

32 bins

imhist(Igray)/numel(Igray); imhist(Igray,32)/numel(Igray)

Roger S. Gaborski

normalized gray scale histogram2
Normalized Gray Scale Histogram

>> p= imhist(Igray)/numel(Igray);

>> figure, plot(p)

probability

Gray level values

Roger S. Gaborski

slide22
Original Dark Light

Roger S. Gaborski

contrast enhancement
Contrast enhancement
  • How could we transform the pixel values of an image so that they occupy the whole range of values between 0 and 255?

Roger S. Gaborski

gray scale transformation
Gray Scale Transformation
  • How could we transform the pixel values of an image so that they occupy the whole range of values between 0 and 255?
  • If they were uniformly distributed between 0 and x we could multiply all the gray level values by 255/x
  • BUT – what if they are not uniformly distributed??

Roger S. Gaborski

cumulative distribution function
Cumulative Distribution Function

Histogram CDF

Roger S. Gaborski

histogram equalization he
Histogram Equalization(HE)
  • HE generates an image with equally likely intensity values
  • Transformation function: Cumulative Distribution Function (CDF)
  • The intensity values in the output image cover the full range, [0 1]
  • The resulting image has higher dynamic range
  • The values in the normalized histogram are approximately the probability of occurrence of those values

Roger S. Gaborski

histogram equalization
Histogram Equalization
  • Let pr(rj), j = 1, 2, … , L denote the histogram associated with intensity levels of a given image
  • Values in normalized histogram are approximately equal to the probability of occurrence of each intensity level in image
  • Equalization transformation is:

k = 1,2,…,L

sk is intensity value

of output

rk is input value

Sum of probability up to k value

Roger S. Gaborski

histogram equalization example
Histogram Equalization Example
  • g = histeq(f, nlev) where f is the original image and nlev number of intensity levels in output image

Roger S. Gaborski

slide29
Original Image

INPUT

Roger S. Gaborski

transformation
Transformation

x255

Output Gray Level Value

Input Gray Level Value

Roger S. Gaborski

slide31
Equalization of Original Image

OUTPUT

Roger S. Gaborski

histogram equalization1
Histogram Equalization

Input Image Output Image

Roger S. Gaborski

adaptive equalization
Adaptive Equalization
  • g = adapthisteq(f, parameters..)
  • Contrast-limited adaptive histogram equalization
  • Process small regions of the image (tiles) individually
  • Can limit contrast in uniform areas to avoid noise amplification

Roger S. Gaborski

slide37
>> help adapthisteq

adapthisteq Contrast-limited Adaptive Histogram Equalization (CLAHE).

adapthisteq enhances the contrast of images by transforming the

values in the intensity image I. Unlike HISTEQ, it operates on small

data regions (tiles), rather than the entire image. Each tile's

contrast is enhanced, so that the histogram of the output region

approximately matches the specified histogram. The neighboring tiles

are then combined using bilinear interpolation in order to eliminate

artificially induced boundaries. The contrast, especially

in homogeneous areas, can be limited in order to avoid amplifying the

noise which might be present in the image.

J = adapthisteq(I) Performs CLAHE on the intensity image I.

J = adapthisteq(I,PARAM1,VAL1,PARAM2,VAL2...) sets various parameters.

Parameter names can be abbreviated, and case does not matter. Each

string parameter is followed by a value as indicated below:

'NumTiles' Two-element vector of positive integers: [M N].

[M N] specifies the number of tile rows and

columns. Both M and N must be at least 2.

The total number of image tiles is equal to M*N.

Default: [8 8].

Roger S. Gaborski

adaptive histogram equalization
Adaptive Histogram Equalization

Default, 8x8 tiles

Roger S. Gaborski

adaptive equalization1
Adaptive Equalization

Roger S. Gaborski

slide40
Chapter 3

www.prenhall.com/gonzalezwoodseddins

Roger S. Gaborski

slide41
Chapter 3

www.prenhall.com/gonzalezwoodseddins

Roger S. Gaborski

histograms
Histograms
  • Histogram is nothing more than mapping the pixels in a 2 dimensional matrix into a vector
  • Each component in the vector is a bin (range of gray level values) and the corresponding value is the number of pixels with that gray level value
similarity between histograms
Similarity between Histograms
  • Similarity between histogram bins:
  • Assuming both histograms have ∑nj j=1…B pixels

M. Swain and D. Ballard. “Color indexing,”International Journal of Computer Vision, 7(1):11–32, 1991.

histogram intersection
Histogram Intersection
  • A simple example:
  • g = [ 17, 23, 45, 61, 15]; (histogram bins)
  • h = [ 15, 21, 42, 51, 17];
  • in=sum(min(h,g))/min( sum(h),sum(g))
  • in =

0.9863

slide45
>> g = [17,23,45,61,15];

>> h = [15,21,42,51,17];

>> min(g,h)

ans=

15 21 42 51 15

>> N = sum(min(g,h))

N =

144

>> D=min(sum(h),sum(g))

D =

146

>> intersection = N/D

intersection =

0.9863

Roger S. Gaborski

if histograms identical
If Histograms Identical
  • g = 15 21 42 51 17
  • h = 15 21 42 51 17
  • >> in=sum(min(h,g))/min( sum(h),sum(g))
  • in =

1

different histograms
Different Histograms
  • h = 15 21 42 51 17
  • g = 57 83 15 11 1
  • >> in=sum(min(h,g))/min( sum(h),sum(g))
  • in =

0.4315

region and histogram
Region and Histogram

Similarity with itself:

>>h = hist(q(:),256);

>> g=h;

>> in=sum(min(h,g))/min( sum(h),sum(g))

in = 1

slide50
>> r=236;c=236;

>> g=im(1:r,1:c);

>> g= hist(g(:),256);

>> in=sum(min(h,g))/min( sum(h),sum(g))

in =

0.5474

partial matches
Partial Matches

>> g= hist(g(:),256);

>> in=sum(min(h,g))/min( sum(h),sum(g))

in =

0.8014

in=sum(min(h,g))/min( sum(h),sum(g))

in =

0.8566

lack of spatial information
Lack of Spatial Information
  • Different patches may have similar histograms
ad