Introduction of computer vision
1 / 52

Introduction of Computer Vision - PowerPoint PPT Presentation

  • Uploaded on

Introduction of Computer Vision. Pedestrian Detection. Finding People in Images and Videos Navneet DALAL Chapter 4: Histogram of Oriented Gradients Based Encoding of Images

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

PowerPoint Slideshow about 'Introduction of Computer Vision' - jariah

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

Pedestrian detection
Pedestrian Detection

  • Finding People in Images and Videos

    • Navneet DALAL


    • Chapter 4: Histogram of Oriented Gradients Based Encoding of Images


    • Histograms of Oriented Gradients for Human Detection


  • INRIA Person Dataset


  • Computer Vision Datasets


Today s topic
Today’s Topic

  • Motion Detection

Motion detection
Motion Detection

  • Temporal Differencing

    • Take the difference between two temporally adjacent frames. The difference is the moving pixels (almost). The static background results in zeros.

    • Can adapt to changing lighting conditions because the difference frames are only 1/30 of a second apart (typical video 30 frames per second – 30 fps)

Motion detection1
Motion Detection

  • Temporal Differencing Issues

    • Not all the relevant pixels extracted

    • Background pixels extracted.

Motion detection2
Motion Detection

Frame at time t Frame at time t+1 Frame Difference

Red Block appears

as two separate objects

Motion detection difference method
Motion DetectionDifference Method

Sidewalk 12_5

Processing video in matlab
Processing Video in Matlab

%C:\Program Files\MATLAB\R2008b\toolbox\OCR\BackgroundAnalysis02_02_2010

bkg = 20; %frames of video to be processed

fname = 'Office1.avi';

vidObj = mmreader(fname);

%Play video


nFrames = vidObj.NumberOfFrames;

rw = vidObj.Height;

cl = vidObj.Width;

numFrames = 1000;


Writing frames to directory
Writing Frames to Directory



Matlab vidobj mmreader fname
MATLAB vidObj = mmreader(fname);


fname = 'sidewalk11_23indeo.avi';

a = aviread(fname); %%OLD METHOD

frameInfo = aviinfo(fname);

totalFrames = frameInfo.NumFrames

for i = 1:50

%for i = 1:totalFrames-1

currentFrameDiff = abs(im2double(a(1,i+1).cdata)-im2double(a(1,i).cdata));

movDiff(i) = im2frame (currentFrameDiff);


%MATLAB Movie file

figure, movie(movDiff)


%movie2avi(movDiff,'sidewalk12_05_07.avi','compression', 'none');

Processing avi files
Processing .avi files


fname = 'CarsTarget2.avi';

% extracting the frame information.

%frameInfo = aviinfo( strcat( pathname, fname ));

frameInfo = aviinfo( fname );

disp( frameInfo );

for cnt = 1:20


frame1 = mov1(1,1).cdata; %uint8

image1= im2double(frame1);





Motion detection3
Motion Detection

  • Background Modeling

    • Model background without moving objects

      • Represent each pixel in the frame with a 3D Gaussian – mean red, green, blue and covariance matrix

      • For each pixel, collect n pixel triplets.

      • Use triplets to estimate mean and covariance matrix

      • Process future frames by determining the probability of each pixel in the new frame

      • Threshold the probability, p(r,c)>thres is a foreground pixel (moving object)

    • Compare pixel values in current frame and estimate if pixel is represented by background distribution or more likely from a different distribution (therefore new object not in background)

Updating gaussian distributions
Updating Gaussian Distributions

  • Small changes in the environment will result in thresholding errors

  • Adapt the Gaussian models by calculating a weighted average

    • Estimate means and covariance matrix from initial frames

    • Update distributions using pixels identified as background – distributions will adjust for slight changes in lighting conditions

Introduction of computer vision

Pixel modeling stationary camera
Pixel Modeling identity matrixStationary Camera

Sidewalk Threshold

Overpass identity matrix

Object Tracking Overpass

Non stationary camera
Non-stationary Camera identity matrix

  • Example: A camera panning a scene

  • One approach is to register the adjacent frames

    • Find key points in adjacent frames

    • Determine offset

    • Adjust images so that they overlap

    • Take difference

Need to find correspondence between feature points in two different images

  • Cannot match individual pixels

  • Need to use a window containing many pixels (5x5, 7x7, 21x21, etc)

Introduction of computer vision

Feature points correspondence
Feature Points / Correspondence robust

  • Points should be extracted consistently over different views

  • Points should be invariant to scaling, rotation, changes in illumination

  • Information in the neighborhood of the point should be unique so that it can be matched

Select window region match region in second image
Select Window Region robustMatch Region in Second Image

Calculate difference between the two patches


Randomly select patch
Randomly Select Patch robust

patch = I(80:110,200:230);

For Demonstration Use Only Strip Containing Patch

Normalized cross correlation refer to equation on page p313 also matlab docs
Normalized Cross Correlation (Refer to equation on page p313)Also MATLAB docs

  • w is template

  • w is average value of elements in template

  • f is the image

  • f is the average of the image where f and w overlap

  • Denominator normalizes resulting in an output range of -1, +1

  • High value for absolute value of output is a good match

Matlab cross correlation function g normxcorr2 template f
MATLAB Cross Correlation Function p313)g = normxcorr2(template, f)

Find max value in g
Find Max Value in |g| p313)

d = abs(g);

[ypeak, xpeak] = find(d == max(d(:)));

%Adjust location by size of template

ypeak = ypeak-(size(patch,1)-1)/2;

xpeak = xpeak-(size(patch,2)-1)/2;

fprintf('\n Center of Patch: ypeak is

%d and xpeak is %d \n\n\n', ypeak, xpeak);

figure, imshow(Igray)

hold on

plot(xpeak, ypeak, 'ro')

Introduction of computer vision

Red – strongest response p313)

Green – second strongest response

But how do we select points
But How Do We Select Points? p313)

  • Junctions or Corners

  • Stable over changes in viewpoint

Moravec s corner detector
Moravec p313)’s Corner Detector

  • Overview:

    • Select window size

    • Shift window over image region

      • If window over uniform region, shifts in all directions will result in small changes

      • If window over edge, shifts along edge will results in small changes, but shifts across edge will result in large changes

        • along edge – no change

        • Perpendicular to edge – large change

      • If window over corner, than shifts in all directions will result will result in large changes

  • Detect corner by finding regions that have large changes in all directions

Subtract first window from second window1
Subtract First Window from Second Window p313)

Window moved vertically, no change

Window moved horizontally, no change

Window moved in either

direction, large change

Harris points
Harris Points p313)

Corner Response function, C:

C = det(A) – αtrace2(A), where A is the autocorrelation matrix


Fig. 1: Autocorrelation matrix,

where w(x, y) is the window function and I(x, y) is the image

REF: image from Wikipedia

Non stationary camera1
Non-stationary Camera p313)

  • Example: A camera panning a scene

  • One approach is to register the adjacent frames

    • Find key points in adjacent frames

    • Determine offset

    • Adjust images so that they overlap

    • Take difference

Two sequential frames color
Two Sequential Frames - Color p313)

What if you just simply take the difference between two adjacent frames?

Difference p313)