- August
Posted By : Dave Hartburn
OpenCV Python Samples

OpenCV comes with a number of sample programs, in the samples\python directory. Below is a brief description of each. The more interesting demos are marked in bold. The list is by no means detailed and gives an overview from a brief skim through, without knowing what is going on in the backend. The purpose in composing this list was to become aware of what demos exist before learning how to use OpenCV.

Note: Press escape on each to quit most applications.

asifit.pyDraws lines between pictures in different orientations, matching features. E.g. an aerial photo from different angles.
audio_spectrogram.pyLibrary – For drawing audio graphics
browse.pyCalled with an image file, shows a thumbnail with high resolution zoom on mouse over.
calibrate.pyCamera calibration for distorted images.
camshift.pyTracks an object, blacking out most of the rest of the image
coherence.pyDraws coherence lines from an image, similar to the pencil drawing style filters in GIMP. Drag sliders and press space to redraw.
color_histogram.pyDraws a live colour histogram of the video feed.
common.pyLibrary: Common routines used by samples
contours.pyFinds contour lines in an image
deconvolution.pyDemonstrates deconvolution
demo.pyBrowse and launch sample programs, with descriptions. Similar to this list but interactive.
dft.pyPerforms a fourier transform. No further information if it is interactive or not.
digits_adjust.pyDigit recognition adjustment. Produces a NPZ file. More details needed.
digits.pyMatches digits in an image
digits_video.pyRecognises digits in a video stream
dis_opt_flow.pyShows optical flow / movement. Moving objects displayed by pressing 2
distrans.pyDistance transform sample
drawing.pyDemonstrates various drawing tools
edge.pyLive edge detection
facedetect.pyDetects faces
feature_homography.pyFeature detection
find_obj.pyFinds an object from one image in another
fitline.pyVarious line fitting algorithms, ignoring outliers
floodfill.pyFlood fill an area of an image
gabor_threads.py“use of multiple Gabor filter convolutions to get Fractalius-like image effect”. Takes an image, detects edges and gives them a neon style glow. Gives some very interesting effects.
gaussian_mix.pyUnclear what this is doing!
grabcut.pyMarks foreground and background areas, but not clear exactly how to work this.
hist.pyDemo for drawing histograms
houghcircles.pyDetects circles in an image
houghlines.pyHough transforms to detect lines in image
inpaint.pyAttempts to repair damage to an image
kalman.pyTracks a moving point
kmeans.pyK-means cluster sample
laplace.pyLaplace point and edge detection
lappyr.pyLaplacian Pyramid construction and merging
letter_replace.pyDB training for letter recognition/ Random Trees Classifier demo
lk_homography.pyLucas-Kanade homography tracker. Tracks features
lk_track.pyLucas-Kanade sparse optical flow demo. Feature / movement tracking
logpolar.pyPlots image as logPolar and linearPolar
morphology.pyMorphology operations
mosse.pyThis sample implements correlation-based tracking approach
mouse_and_match.pyMatches parts of an image with that selected by the mouse
mser.pyMSER edge/feature detection
opencv_version.pyPrints the OpenCV version and build options
opt_flow.pyOptical flow demo – motion detection
peopledetect.pyDetects people in still images
plane_ar.pyDraws augmented reality over a image tracking feed
plane_tracker.pyMotion tracking
qrcode.pyDetects and decodes QR codes
squares.pyDetect squares in images
stereo_match.pySimple example of stereo image matching and point cloud generation
stitching_detailed.pyShow how to use the Stitcher API from python (not tried)
stitching.pyAnother stitching example, create panoramas (not tried)
text_skewness_correction.pyDemonstrates how to correct skewness (rotation) in text and correct
texture_flow.pyShows the flow of textures in an image.
tracker.pyTracks a region of interest through a video
tst_scene_render.pyUnclear what this is doing!
turing.pyDemo of cyclical Turing patterns
video.pyVideoCapture class, shows video stream and captures stills
video_threaded.pyDemonstrates multithreaded video capture and processing
video_v4l2.pyDemo of Video 4 Linux backend
watershed.pyDemo of OpenCV watershed segmentation algorithm

Leave a Reply