- 103 Views
- Uploaded on
- Presentation posted in: General

Introduction of Computer Vision

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 - - - - - - - - - - - - - - - - - - - - - - - - - -

Introduction of Computer Vision

- Finding People in Images and Videos
- Navneet DALAL
- http://lear.inrialpes.fr/people/dalal/NavneetDalalThesis.pdf
- Chapter 4: Histogram of Oriented Gradients Based Encoding of Images
- http://lear.inrialpes.fr/pubs/2005/DT05/cvpr2005_talk.pdf
- Histograms of Oriented Gradients for Human Detection http://lear.inrialpes.fr/pubs/2005/DT05/hog_cvpr2005.pdf

- INRIA Person Dataset
- http://pascal.inrialpes.fr/data/human/

- Computer Vision Datasets
- http://clickdamage.com/sourcecode/cv_datasets.html

- 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)

- Temporal Differencing Issues
- Not all the relevant pixels extracted
- Background pixels extracted.

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

Red Block appears

as two separate objects

Sidewalk 12_5

%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

implay('Office1.avi');

nFrames = vidObj.NumberOfFrames;

rw = vidObj.Height;

cl = vidObj.Width;

numFrames = 1000;

CODE TO PROCESS FRAMES HERE

imwrite(objBox,['.\video\','LabScene','.',num2str(i),'.jpg'],'jpg');

imwrite(objBoxVideo,['.\video\','LabSceneColor','.',num2str(i),'.jpg'],'jpg');

%motionDet.m

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);

end

%MATLAB Movie file

figure, movie(movDiff)

% FOR AVI MOVIE

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

%readWriteAviFiles

fname = 'CarsTarget2.avi';

% extracting the frame information.

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

frameInfo = aviinfo( fname );

disp( frameInfo );

for cnt = 1:20

mov1=aviread(fname,cnt);

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

image1= im2double(frame1);

figure,imshow(image1);

%WRITE INDIVIDUAL FRAMES TO DIRECTORY

imwrite(image1,['.\video\','CarVideo','.',num2str(cnt),'.jpg'],'jpg');

end

- VirtualDub

- 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)

- Model background without moving objects

- 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

- Instead of using estimated covariance matrix use the identity matrix
- How does this change affect performance??

Sidewalk Threshold

Object Tracking Overpass

- 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

- Cannot match individual pixels
- Need to use a window containing many pixels (5x5, 7x7, 21x21, etc)

- Matching on a continuum like texture and edges not very robust
- Many edges (and parts of edges) will match

- At the very least:
- Need to find interest points
- Extract patches around interest points
- Match patches

- 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

Calculate difference between the two patches

WindowMatching_ACV.m

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

For Demonstration Use Only Strip Containing Patch

- 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

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')

Red – strongest response

Green – second strongest response

- Junctions or Corners
- Stable over changes in viewpoint

- 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

Window moved vertically, no change

Window moved horizontally, no change

Window moved in either

direction, large change

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

- 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

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