廣宣學堂: 機器視覺初探 10152017

Post on 23-Jan-2018

300 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

& &

Jerry

•• ”

•• Founder

•• MITedX/MandarinX

•• https://www.ap-mic.com

• http://dataology.blogspot.tw

• https://www.linkedin.com/in/jerry2012/

���(Jerry)

dsjerry2017@gmail.com 2

�������

�������

�����

3

�������������������

VM

• vmware-tools-distrib

• sudo ./vmware-install.pl

Jupyter Notebook

• sudo pip3installjupyter• sudo apt-getinstallpython3-matplotlib

(ComputerVision)

•Makecomputersunderstandimagesandvideo.

-

-

-

U

• Safety• Health• Security• Comfort

• Fun• Access• …….

• 1960• 1970• 1990 C 3

• 2000• 2030

-OCR

(OCR,OpticalCharacterRecognition)

- Facedetection

- Smiledetection

- Objectrecognition

- Vision-basedbiometrics

- Loginwithoutapassword

- ShapeCapture&MotionCapture

- Self-DrivingCars

Mobileye

– Visionsystemscurrentlyinhigh-endBMW,GM,Volvo,Tesla

- InteractiveGames:Kinect

- Industrialrobots

- Medicalimaging

• ViewpointVariations

image credit: J. Koenderink

a

• Occlusion

image credit: Magritte, 1957

• Clutter

3D

• OpticalIllusions

OpenCV?

OpenCV

• OpenCV 2000 17

• Intel

• *••

• S

• OpenCV C++

• ' Python,Java,Matlab,C#,Ruby

• OpenCV• Windows MacOS Linux Android

Python+OpenCV

• P OpenCV

• (CV)

• OpenCV

• Python Numpy Scikit-learn

• BSD S

•• Windows Mac Linux

•' CUDA GPU

• Python

?

Title

RGB

3

••

3

3

RGB &HSV

• RGB U RGBcolormodel

Red Green Blue

a V

• HSL Hue,Saturation,

Lightness HSL

• H

• S

0-100%

• V 0-100%

3

OpenCV storescolorintheBGRformat.

3

RGB 3

3 (RGB)

BGR

• cv2.calcHist(images,channels,mask,histSize,ranges[,hist[,

accumulate]])

• images:

• Channels [0] [0],[1],[2]( )

• Mask None

• histSize 3 bins [256]

• Ranges [0,256]

ravel() array

calcHist

enumerate col

OpenCV

•3 (Square)

np.zeros array

OpenCV

• (Line)

Cv2.line( )

OpenCV

• 3 (Rectangle)

OpenCV

• (Circle)

OpenCV

• (Polygon)

ImageManipulations

(Transformations)

• (Transformations) : (Affine) (Non-Affine)

• (Affine)

• (Non-Affine) Scaling

Rotation

Translation

(Translations)

Tx 311.25

Ty 207.5

TxTy

(Rotations)Cos θ -Sin θ

Sinθ Cosθ

θ ”

θ

*X Y

(Rotations)-Transpose

c (HorizontalFlip)1 c0

-1 c

*(Scaling) (Resizing) (Interpolations)

* 3/4

cv2.INTER_AREA

* cv2.INTER_CUBIC

resize cv2.INTER_LINEAR

None Fx Fy *

(ImagePyramids)

(Cropping)

r (Added)& (Subtracted)

Mr

(Bitwise)&“ (Masking)

BitwiseOperationsandMasking

3

(Convolutions)&U (Blurring)

(Sharpening)

Thresholding,Binarization &AdaptiveThresholding

127 0 255

127 255 127 0

127 127 255

127 0 127

127 127 0

Thresholding,Binarization &AdaptiveThresholding

127 0 255

U o

Adaptive Threshold

y

(Dilation)& (Erosion)

Kernel

u(EdgeDetection)

Sobel

## threshold1 threshold2

R 2

1

1 2 e

#intensities 60 R

120

Canny u RR

u(EdgeDetection)

(PerspectiveTransform)

4

A4 1 1.41 a

(PerspectiveTransform)

Webcam Sketch

GuassianBlurs

cap VideoCapture

frame

ImageSegmentation

(Contours)

3

(SortingContours)

Canny

LineDetection- UsingHoughLines

Canny

1 rho HoughLines

np.pi/180 1

240

LineDetection- UsingHoughLines(2)

BlobDetection

u

u

u blob

CountingCirclesandEllipses(1)

u

u

blob

Identifiy ContoursbyShape(2)y

y

y

y

y

u

u

uObjectDetection

(Waldo)

Martin Handford

n——

D

FindingWaldo

FindingCorners

cornerHarris float32

FeatureDetection- SIFT

SIFTFeatureDetector

u

FeatureDetection- SURF

SURFFeatureDetector

FeatureDetection- FAST

FAST u #fast=cv2.FastFeatureDetector

FeatureDetection-OrientedFASTandRotatedBRIEF(ORB)

ORB

HistogramofOrientedGradients(1)

hxw( )

hxw

OpenCV HOG

winSize

hog_feats numpy

HistogramofOrientedGradients(2)

# R

Matplotlib HOG

360/nbins*3

SIFTWebcamDemo

Runfeature_homography.py

uFaceDetection

u

OpenCV CascadeClassifier

XML-

u ROI

u face_classifier

faces

u

Webcam Demo(1)

MergingFaces(1)

U

MergingFaces(2)

x y

MergingFaces(3)

MergingFaces(4)

t e

MergingFaces(5)

MergingFaces(6)

MergingFaces(7)

MotionAnalysis- YawnDetectorandCounting

• OpenCV u

YawnDetectorandCounting(1)

YawnDetectorandCounting(2)

YawnDetectorandCounting(3)

• OpenCV iPhone X FaceID

• c

• 2D3 3D

• iPhone X (Infrared)

- U

numpy

numpy

U

- Webcam Demo(1)

- Webcam Demo(2)

U uc

• face_recognitionexamples/facerec_

from_webcam.py

ObjectTracking

(ObjectTracking)

• u

• u Video

Tracking 3

• (OpticalFlow)

(ObjectTracking)

u

Lucaskanade

(ObjectTracking)

1

dsjerry2017@gmail.comjerry@mail.ntust.edu.tw

dsjerry2017@gmail.com 123

• opencv examples/lk_homography.py

• opencv examples/python3lk_track.py

top related