学习 opencv-cpp basic 示例程序 目录
- 3calibration.cpp
- application_trace.cpp
- bgfg_segm.cpp
- calibration.cpp
- camshiftdemo.cpp
- cloning_demo.cpp
- cloning_gui.cpp
- connected_components.cpp
- contours2.cpp
- convexhull.cpp
- cout_mat.cpp
- create_mask.cpp
- dbt_face_detection.cpp
- delaunay2.cpp
- demhist.cpp
- detect_blob.cpp
- detect_mser.cpp
- dft.cpp
- distrans.cpp
- dis_opticalflow.cpp
- drawing.cpp
- edge.cpp
- ela.cpp
- em.cpp
- facedetect.cpp
- facial_features.cpp
- falsecolor.cpp
- fback.cpp
- ffilldemo.cpp
- filestorage.cpp
- fitellipse.cpp
- grabcut.cpp
- imagelist_creator.cpp
- imagelist_reader.cpp
- image_alignment.cpp
- inpaint.cpp
- kalman.cpp
- kmeans.cpp
- laplace.cpp
- letter_recog.cpp
- lkdemo.cpp
- logistic_regression.cpp
- mask_tmpl.cpp
- matchmethod_orb_akaze_brisk.cpp
- minarea.cpp
- morphology2.cpp
- neural_network.cpp
- npr_demo.cpp
- opencv_version.cpp
- pca.cpp
- peopledetect.cpp
- phase_corr.cpp
- points_classifier.cpp
- polar_transforms.cpp
- qrcode.cpp
- segment_objects.cpp
- select3dobj.cpp
- smiledetect.cpp
- squares.cpp
- stereo_calib.cpp
- stereo_match.cpp
- stitching.cpp
- stitching_detailed.cpp
- train_HOG.cpp
- train_svmsgd.cpp
- travelsalesman.cpp
- tree_engine.cpp
- videocapture_basic.cpp
- videocapture_camera.cpp
- videocapture_gphoto2_autofocus.cpp
- videocapture_gstreamer_pipeline.cpp
- videocapture_image_sequence.cpp
- videocapture_intelperc.cpp
- videocapture_openni.cpp
- videocapture_starter.cpp
- videowriter_basic.cpp
- warpPerspective_demo.cpp
- watershed.cpp
3calibration.cpp
This is a camera calibration sample that calibrates 3 horizontally placed cameras together
application_trace.cpp
OpenCV Application Tracing support demo. (?)
bgfg_segm.cpp
OpenCV background foreground segmentation
calibration.cpp
example command line for calibration from a live feed.
example command line for calibration from a list of stored images:
camshiftdemo.cpp
User draws box around object to track. This triggers CAMShift to start tracking
cloning_demo.cpp
This tutorial demonstrates how to use OpenCV seamless cloning module without GUI.
1- Normal Cloning
2- Mixed Cloning
3- Monochrome Transfer
4- Color Change
5- Illumination change
6- Texture Flattening
The program takes as input a source and a destination image (for 1-3 methods) and outputs the cloned image.
cloning_gui.cpp
This tutorial demonstrates how to use OpenCV seamless cloning
module.
1- Normal Cloning
2- Mixed Cloning
3- Monochrome Transfer
4- Color Change
5- Illumination change
6- Texture Flattening
The program takes as input a source and a destination image (for 1-3 methods) and outputs the cloned image.
connected_components.cpp
This program demonstrates connected components and use of the trackbar
The image is converted to grayscale and displayed, another image has a trackbar that controls thresholding and thereby the extracted contours which are drawn in color
contours2.cpp
This program illustrates the use of findContours and drawContours. The original image is put up along with the image of drawn contours
convexhull.cpp
This sample program demonstrates the use of the convexHull() function
cout_mat.cpp
This program shows the serial out capabilities of cv::Mat. That is, cv::Mat M(…); cout << M; Now works. Output can be formatted to OpenCV, matlab, python, numpy, csv and C styles
create_mask.cpp
This tutorial demonstrates how to make mask image (black and white). The program takes as input a source image and outputs its corresponding mask image.
dbt_face_detection.cpp
DBT(Dempster Belief Theory, 法官信念理论)Face Detection example
delaunay2.cpp
This program demonstrates iterative construction of delaunay triangulation and voronoi tessellation. It draws a random set of points in an image and then delaunay triangulates them.
demhist.cpp
This program demonstrates the use of calcHist() – histogram creation.
detect_blob.cpp
This program demonstrates how to use BLOB to detect and filter region
detect_mser.cpp
This program demonstrates how to use MSER (Maximally Stable Extrernal Regions,最大稳定极值区域) to detect extremal regions
dft.cpp
This program demonstrated the use of the discrete Fourier transform (dft) The dft of an image is taken and it’s power spectrum is displayed.
distrans.cpp
Program to demonstrate the use of the distance transform function between edge images.
dis_opticalflow.cpp
Fast Optical Flow using Dense Inverse Search (密集的逆搜索)
drawing.cpp
This program demonstrates OpenCV drawing and text output functions.
edge.cpp
This sample demonstrates Canny edge detection
ela.cpp
Error Level Analysis (ELA)
- Error Level Analysis (ELA) permits identifying areas within an image that are at different compression levels. With JPEG images, the entire picture should be at roughly the same level. If a section of the image is at a significantly different error level, then it likely indicates a digital modification.
- Edges: Similar edges should have similar brightness in the ELA result. All high-contrast edges should look similar to each other, and all low-contrast edges should look similar. With an original photo, low-contrast edges should be almost as bright as high-contrast edges.
- Textures: Similar textures should have similar coloring under ELA. Areas with more surface detail, such as a close-up of a basketball, will likely have a higher ELA result than a smooth surface.
- Surfaces: Regardless of the actual color of the surface, all flat surfaces should have about the same coloring under ELA.
- https://fotoforensics.com/tutorial-ela.php
em.cpp
Expectation Maximization (EM) algorithm estimates the parameters of the multivariate probability density function in the form of a Gaussian mixture distribution with a specified number of mixtures.
facedetect.cpp
This program demonstrates the use of cv::CascadeClassifier class to detect objects (Face + eyes). You can use Haar or LBP features. This classifier can recognize many kinds of rigid objects, once the appropriate classifier is trained.It’s most known use is for faces.
facial_features.cpp
A program to detect facial feature points using Haarcascade classifiers for face, eyes, nose and mouth
falsecolor.cpp
This program demonstrates the use of applyColorMap function.
fback.cpp
This program demonstrates dense optical flow algorithm by Gunnar Farneback Mainly the function: calcOpticalFlowFarneback()
ffilldemo.cpp
This program demonstrated the floodFill() function (FloodFill(漫水填充)函数)
filestorage.cpp
filestorage_sample demonstrate the usage of the opencv serialization functionality
- filestorage_sample demonstrate the usage of the opencv serialization functionality.
- This program demonstrates the use of FileStorage for serialization, that is in use << and >> in OpenCV For example, how to create a class and have it serialize, but also how to use it to read and write matrices. FileStorage allows you to serialize to various formats specified by the file end type. You should try using different file extensions.(e.g. yaml yml xml xml.gz yaml.gz etc…)
fitellipse.cpp
This program is demonstration for ellipse fitting. The program finds contours and approximate it by ellipses. Three methods are used to find the elliptical fits: fitEllipse, fitEllipseAMS and fitEllipseDirect.
grabcut.cpp
This program demonstrates GrabCut segmentation – select an object in a region and then grabcut will attempt to segment it out.
imagelist_creator.cpp
This creates a yaml or xml list of files from the command line args
imagelist_reader.cpp
This program gets you started being able to read images from a list in a file
image_alignment.cpp
This file demonstrates the use of the ECC image alignment algorithm. When one image is given, the template image is artificially formed by a random warp. When both images are given, the initialization of the warp by command line parsing is possible.
inpaint.cpp
Cool inpainging demo. Inpainting (图像修复) repairs damage to images by floodfilling the damage with surrounding image areas.
kalman.cpp
Example of c calls to OpenCV’s Kalman filter. Tracking of rotating point.Rotation speed is constant. Both state and measurements vectors are 1D (a point angle), Measurement is the real point angle + gaussian noise. The real and the estimated points are connected with yellow line segment, the real and the measured points are connected with red line segment. (if Kalman filter works correctly, the yellow segment should be shorter than the red one).
- 学习OpenCV2——卡尔曼滤波(KalmanFilter)详解 https://blog.csdn.net/GDFSG/article/details/50904811
kmeans.cpp
This program demonstrates kmeans clustering.
- It generates an image with random points, then assigns a random number of cluster centers and uses kmeans to move those cluster centers to their representitive location
laplace.cpp
This program demonstrates Laplace point/edge detection using OpenCV function Laplacian(). It captures from the camera of your choice: 0, 1, … default 0
letter_recog.cpp
The sample demonstrates how to train Random Trees classifier (or Boosting classifier, or MLP, or Knearest, or Nbayes, or Support Vector Machines - see main()) using the provided dataset.
lkdemo.cpp
This is a demo of Lukas-Kanade optical flow lkdemo(), It uses camera by default, but you can provide a path to video as an argument.
logistic_regression.cpp
logistic regression,这个算法只能解决简单的线性二分类,在众多的机器学习分类算法中并不出众,但它能被改进为多分类,并换了另外一个名字softmax, 这可是深度学习中响当当的分类算法。
mask_tmpl.cpp
This program demonstrates the use of template matching with mask.
- Use the OpenCV function matchTemplate() to search for matches between an image patch and an input image
- Use the OpenCV function minMaxLoc() to find the maximum and minimum values (as well as their positions) in a given array.
matchmethod_orb_akaze_brisk.cpp
This program demonstrates how to detect compute and match ORB BRISK and AKAZE descriptors
minarea.cpp
This program demonstrates finding the minimum enclosing box, triangle or circle of a set of points using functions: minAreaRect() minEnclosingTriangle() minEnclosingCircle(). Random points are generated and then enclosed.
morphology2.cpp
Morphology Transformations Demo
neural_network.cpp
opencv nuural_network: create random training data, create the neural network.
npr_demo.cpp
This tutorial demonstrates how to use OpenCV Non-Photorealistic Rendering Module.
- Edge Preserve Smoothing
-> Using Normalized convolution Filter
-> Using Recursive Filter- Detail Enhancement
- Pencil sketch/Color Pencil Drawing
- Stylization
opencv_version.cpp
This sample outputs OpenCV version and build configuration.
pca.cpp
This program demonstrates how to use OpenCV PCA with a
specified amount of variance to retain. The effect
is illustrated further by using a trackbar to
change the value for retained varaince.
The program takes as input a text file with each line
begin the full path to an image. PCA will be performed
on this list of images. The author recommends using
the first 15 faces of the AT&T face data set:
http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html
peopledetect.cpp
This sample demonstrates the use ot the HoG descriptor. Detect people’s whole body figure.
phase_corr.cpp
Demonstrates estimating translational shift between two successive frames using Phase Correlation.
points_classifier.cpp
points_classifier
#define NBC 1 // normal Bayessian classifier
#define KNN 1 // k nearest neighbors classifier
#define SVM 1 // support vectors machine
#define DT 1 // decision tree
#define BT 1 // ADA Boost
#define GBT 0 // gradient boosted trees
#define RF 1 // random forest
#define ANN 1 // artificial neural networks
#define EM 1 // expectation-maximization
polar_transforms.cpp
This program illustrates Linear-Polar (线性极坐标变换) and Log-Polar (对数极坐标变换) image transforms
qrcode.cpp
This program detects the QR-codes (二维码) from camera or images using the OpenCV library.
segment_objects.cpp
This program demonstrated a simple method of connected components clean up of background subtraction. When the program starts, it begins learning the background. You can toggle background learning on and off by hitting the space bar.
select3dobj.cpp
This program’s purpose is to collect data sets of an object and its segmentation mask.
"It shows how to use a calibrated camera together with a calibration pattern to compute the homography of the plane the calibration pattern is on. It also shows grabCut segmentation etc.
smiledetect.cpp
This program demonstrates the smile detector.
squares.cpp
Square Detection Demo
It loads several images sequentially and tries to find squares in each image
A program using pyramid scaling, Canny, contours and contour simplification to find squares in a list of images (pic1-6.png) Returns sequence of squares detected on the image.
stereo_calib.cpp
Given a list of chessboard images, the number of corners (nx, ny) on the chessboards, and a flag: useCalibrated for calibrated (0) or uncalibrated (1: use stereoCalibrate(), 2: compute fundamental matrix separately) stereo.
Calibrate the cameras and display the rectified results along with the computed disparity images.
stereo_match.cpp
Demo stereo matching converting L and R images into disparity and point clouds
stitching.cpp
Images stitcher (图像缝合).
stitching_detailed.cpp
Rotation model images stitcher.
http://amroamroamro.github.io/mexopencv/opencv/stitching_demo.html
train_HOG.cpp
train histogram of oriented gradients (HOG) descriptor.
train_svmsgd.cpp
train support vector machine (支持向量机) Stochastic Gradient Descent (SGD) (随机梯度下降
深度学习——优化器算法Optimizer详解(BGD、SGD、MBGD、Momentum、NAG、Adagrad、Adadelta、RMSprop、Adam) https://www.cnblogs.com/guoyaohua/p/8542554.html
travelsalesman.cpp
旅行推销员算法
tree_engine.cpp
This sample demonstrates how to use different decision trees and forests including boosting and random trees.
videocapture_basic.cpp
A very basic sample for using VideoCapture and VideoWriter
videocapture_camera.cpp
Operating camera with configuration
videocapture_gphoto2_autofocus.cpp
“This program demonstrates usage of gPhoto2 VideoCapture.\n\n”
"With OpenCV build without gPhoto2 library support it will "
“do nothing special, just capture.\n\n”
“Simple implementation of autofocus is based on edges detection.\n”
“It was tested (this example) only with Nikon DSLR (Nikon D90).\n”
“But shall work on all Nikon DSLRs, and with little effort with othdevices.\n”
“Visit http://www.gphoto.org/proj/libgphoto2/support.php\n”
“to find supported devices (need Image Capture at least).\n”
“Before run, set your camera autofocus ON.\n\n”;
videocapture_gstreamer_pipeline.cpp
GStreamer 是一个基于管道的多媒体框架,基于GObject,以C语言写成。
凭借GStreamer,程序员可以很容易地创建各种多媒体功能组件,包括简单的音频回放,音频和视频播放,录音,流媒体和音频编辑。基于流水线设计,可以创建诸如视频编辑器、流媒体广播和媒体播放器等等的很多多媒体应用。
【GStreamer】GStreamer学习资源汇总 https://mlh.app/2018/03/24/04faa85307086290e8a59b3b21927b70.html
videocapture_image_sequence.cpp
This sample shows you how to read a sequence of images using the VideoCapture interface.
videocapture_intelperc.cpp
This program demonstrates usage of camera supported by Intel Perceptual computing SDK.
videocapture_openni.cpp
This program demonstrates usage of depth sensors (Kinect, XtionPRO,…).
videocapture_starter.cpp
The program captures frames from a video file, image sequence (01.jpg, 02.jpg … 10.jpg) or camera connected to your computer.
videowriter_basic.cpp
A very basic sample for using VideoWriter and VideoCapture
warpPerspective_demo.cpp
This is a demo program shows how perspective transformation applied on an image.
watershed.cpp
This program demonstrates the famous watershed segmentation algorithm in OpenCV: watershed()