Sei sulla pagina 1di 20

www.utem.edu.

my

UNIVERSITY TEKNIKAL MALAYSIA MELAKA

Object Detection & Description

Click to edit Master subtitle style Engr. Khairul Muzzammil b. Saipullah

Content
www.utem.edu.my

Thresholding Object detection (Basic) Face detection Object description (Feature Extraction)

5/4/12

Thresholding
www.utem.edu.my

Convert image into binary image (Black or White) Ex: if pixel >150 -->255, pixel <=150 0

A=imread('images.jpg'); A=rgb2gray(A); B=A; B(A>150)=255; B(A<=150)=0; imshow(B);

5/4/12

Thresholding
www.utem.edu.my

Auto thresholding using Otsu thresholding Optimum division between foreground and background

A=imread('images.jpg'); A=rgb2gray(A); B=im2bw(A); imshow(B);

5/4/12

Thresholding
www.utem.edu.my

Auto thresholding using Otsu thresholding Optimum division between foreground and background

>> a=imread('coin.jpg'); >> b=im2bw(rgb2gray(a)); >> imshow(~b)%inverse black and white

5/4/12

Object Detection
www.utem.edu.my

Using Otsu thresholding try to locate the ball

>> A=imread('ball.jpg'); >> b=im2bw(rgb2gray(A)); >> imshow(b)

5/4/12

Object Detection
www.utem.edu.my

Remove the noise using morphology method in order to make the image clearer

>> A=imread('ball.jpg'); >> b=im2bw(rgb2gray(A)); >>P=3000; >> BW2 = bwareaopen(b,P); >>BW3 = bwmorph(BW2,'dilate'); >>imshow(BW3)

5/4/12

Object Detection
www.utem.edu.my

Get the top, bottom, left and right boundary of the object Get the center coordinate

X=left+(Right-left)/2 Y=top+(down-top)/2

A=imread('ball.jpg'); b=im2bw(rgb2gray(A)); P=3000; BW2 = bwareaopen(b,P); BW3 = bwmorph(BW2,'dilate'); [cx,cy,hh,ww]=findboundary(BW3); imshow(BW3); hold on; plot(cx,cy,'r*'); plot(cx,cy-hh/2,'r*'); plot(cx,cy+hh/2,'r*'); plot(cx+ww/2,cy,'r*'); plot(cx-ww/2,cy,'r*');

5/4/12

Object Detection
www.utem.edu.my

Finally, you can get the region of the object on the original image

A=imread('ball.jpg'); b=im2bw(rgb2gray(A)); P=3000; BW2 = bwareaopen(b,P); BW3 = bwmorph(BW2,'dilate'); [cx,cy,hh,ww]=findboundary(BW3); imshow(A); rectangle( 'Position',[cx-hh/2,cy-ww/2, hh,ww],'EdgeColor','r', 'LineWidth',2);

5/4/12

www.utem.edu.my

UNIVERSITY TEKNIKAL MALAYSIA MELAKA

FACE DETECTION

Click to edit Master subtitle style

First Method
www.utem.edu.my

Copy face_detection_aruma.zip , unzip it and drag it to Matlab Current Folder

5/4/12

www.utem.edu.my

Double click the folder , subfolders and the files will appear as shown.

5/4/12

www.utem.edu.my

Double click at facedetection.m and at the top of the file, edit the input image part.ex: i=imread(face_database/face4.jpg); Click run and usually for the first time this window will be popped up Click Change Directory

5/4/12

First Method Outputs


www.utem.edu.my

For the face4.jpg image, the outputs will be shown as below

5/4/12

Second Method
www.utem.edu.my

Copy FDMver1.0.zip , unzip it and drag it to Matlab Current Folder

5/4/12

www.utem.edu.my

Under that folder, Double click at ex01.m and run it.

5/4/12

Second Method Output


www.utem.edu.my

The output will appear as shown. Try to change the input to another picture and see the result.

5/4/12

www.utem.edu.my

UNIVERSITY TEKNIKAL MALAYSIA MELAKA

Description using KEYPOINT

Click to edit Master subtitle style

Keypoint
www.utem.edu.my

The important of significant point in and object Used to describe the object Example

Laplacian of Gaussian (LOG) Harries Corner Susan Corner Gilles Harris Laplace

5/4/12

keypoint
www.utem.edu.my

Open keypointExtraction folder. Open test.m and run it Change the filename in the test.m with other image file and test.

5/4/12

Potrebbero piacerti anche