OpenCV例程赏析
OpenCV例程赏析
①SITF特征检测匹配(目标查找)例程:…\\opencv\\sources\\samples\\python2\\find_obj.py(asift.py)
#!/usr/bin/env python
‘’’
Feature-based image matching sample.
Note, that you will need the https://github.com/opencv/opencv_contrib repo for SIFT and SURF
USAGE
find_obj.py [–feature=<sift|surf|orb|akaze|brisk>[-flann]] [ ]
–feature - Feature to use. Can be sift, surf, orb or brisk. Append ‘-flann’
to feature name to use Flann-based matcher instead bruteforce.
Press left mouse button on a feature point to see its matching point.
‘’’
②图像缩略放大例程:…\\opencv\\sources\\samples\\python2\\brows
#!/usr/bin/env python
‘’’
browse.py
Sample shows how to implement a simple hi resolution image navigation
Usage
browse.py [image filename]
‘’’
③camshift物体跟踪:…\\opencv\\sources\\samples\\python2\\camshif
#!/usr/bin/env python
‘’’
Camshift tracker
This is a demo that shows mean-shift based tracking
You select a color objects such as your face and it tracks it.
This reads from video camera (0 by default, or the camera number the user enters)
http://www.robinhewitt.com/research/track/camshift.html
Usage:
camshift.py [<video source>]To initialize tracking, select the object with mouse
Keys:
ESC - exit
b - toggle back-projected probability visualization
‘’’
④一致增强滤波:…\\opencv\\sources\\samples\\python2\\coherence.py
#!/usr/bin/env python
‘’’
Coherence-enhancing filtering example
inspired by
Joachim Weickert “Coherence-Enhancing Shock Filters”
http://www.mia.uni-saarland.de/Publications/weickert-dagm03.pdf
‘’’
⑤轮廓例子:…\\opencv\\sources\\samples\\python2\\contours.py
#!/usr/bin/env python
‘’’
This program illustrates the use of findContours and drawContours.
The original image is put up along with the image of drawn contours.
Usage:
contours.py
A trackbar is put up which controls the contour level from -3 to 3
‘’’
⑥反褶积(反卷积/反滤波):…\\opencv\\sources\\samples\\python2\\deconvolution.py
#!/usr/bin/env python'''
Wiener deconvolution.Sample shows how DFT can be used to perform Weiner deconvolution [1]
of an image with user-defined point spread function (PSF)Usage:deconvolution.py [--circle][--angle <degrees>][--d <diameter>][--snr <signal/noise ratio in db>][<input image>]Use sliders to adjust PSF paramitiers.Keys:SPACE - switch btw linear/cirular PSFESC - exitExamples:deconvolution.py --angle 135 --d 22 ../data/licenseplate_motion.jpg(image source: http://www.topazlabs.com/infocus/_images/licenseplate_compare.jpg)deconvolution.py --angle 86 --d 31 ../data/text_motion.jpgdeconvolution.py --circle --d 19 ../data/text_defocus.jpg(image source: compact digital photo camera, no artificial distortion)[1] http://en.wikipedia.org/wiki/Wiener_deconvolution
'''
⑦边缘检测:…\\opencv\\sources\\samples\\python2\\edge.py
#!/usr/bin/env python'''
Video capture sample.Sample shows how VideoCapture class can be used to acquire video
frames from a camera of a movie file. Also the sample provides
an example of procedural video generation by an object, mimicking
the VideoCapture interface (see Chess class).'create_capture' is a convenience function for capture creation,
falling back to procedural video in case of error.Usage:video.py [--shotdir <shot path>] [source0] [source1] ...'sourceN is an- integer number for camera capture- name of video file- synth:<params> for procedural videoSynth examples:synth:bg=../data/lena.jpg:noise=0.1synth:class=chess:bg=../data/lena.jpg:noise=0.1:size=640x480Keys:ESC - exitSPACE - save current frame to <shot path> directory'''
⑧人脸检测:…\\opencv\\sources\\samples\\python2\\facedetect.py
#!/usr/bin/env python'''
Video capture sample.Sample shows how VideoCapture class can be used to acquire video
frames from a camera of a movie file. Also the sample provides
an example of procedural video generation by an object, mimicking
the VideoCapture interface (see Chess class).'create_capture' is a convenience function for capture creation,
falling back to procedural video in case of error.Usage:video.py [--shotdir <shot path>] [source0] [source1] ...'sourceN is an- integer number for camera capture- name of video file- synth:<params> for procedural videoSynth examples:synth:bg=../data/lena.jpg:noise=0.1synth:class=chess:bg=../data/lena.jpg:noise=0.1:size=640x480Keys:ESC - exitSPACE - save current frame to <shot path> directory'''
⑨floodfill图片分割:…\\opencv\\sources\\samples\\python2\\floodfill.py
#!/usr/bin/env python
‘’’
Floodfill sample.
Usage:
floodfill.py []
Click on the image to set seed point
Keys:
f - toggle floating range
c - toggle 4/8 connectivity
ESC - exit
‘’’
⑩霍夫圆/线变换检测:…\\opencv\\sources\\samples\\python2\\houghcircles.py(houghlines.py)
#!/usr/bin/python
‘’’
This example illustrates how to use cv.HoughCircles() function.
Usage:
houghcircles.py [<image_name>]
image argument defaults to …/data/board.jpg
‘’’