Opencv Tutorials学习笔记( 4.1.1版本)

以前对Opencv的掌握不太系统,最近工作不太忙,所以想系统的梳理下Opencv官方给出的学习例子,学习的目的主要是查漏补缺,有比较重要的部分会做好笔记,便于将来直接进行查询。

1、 Tutorials

1.1、 The Core Functionality (core module)

1.1.1Mat - The Basic Image Container

主要学习如何使用Mat和打印到控制台

1.1.2How to scan images, lookup tables and time measurement with OpenCV

主要学习如何遍历图像,使用OpenCV衡量程序所使用的时间。

1.1.3 Mask operations on matrices

cv::filter2D 的使用方法

1.1.4 Operations with images

(1)将一个灰阶图像转换为黑色: img = Scalar(0);

(2)选择一个感兴趣区域:Rect r(10, 10, 100, 100); Mat smallImg = img(r);

(3)转换图像的数据类型: src.convertTo(dst, CV_32F);

(4)将32F数据类型的图像转换到8U

        Mat img = imread("image.jpg");
        Mat grey;
        cvtColor(img, grey, COLOR_BGR2GRAY);
        Mat sobelx;
        Sobel(grey, sobelx, CV_32F, 1, 0);
        double minVal, maxVal;
        minMaxLoc(sobelx, &minVal, &maxVal); //find minimum and maximum intensities
        Mat draw;
        sobelx.convertTo(draw, CV_8U, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
        namedWindow("image", WINDOW_AUTOSIZE);
        imshow("image", draw);
        waitKey();

1.1.5 Adding (blending) two images using OpenCV

主要是addWeighted的介绍

beta = ( 1.0 - alpha );

addWeighted( src1, alpha, src2, beta, 0.0, dst);

1.1.6 Changing the contrast and brightness of an image!

主要学习图像的对比度和亮度调节

(1)在图像的转换过程中 cv::saturate_cast 的使用。

1.1.7Discrete Fourier Transform

离散傅里叶变换

1.1.8File Input and Output using XML and YAML files

使用cv::FileStorage 数据结构读取和写入XML和YAML文件

1.1.9How to use the OpenCV parallel_for_ to parallelize your code

使用opencv的parallel_for_framework框架进行并行加速

1.2、 Image Processing (imgproc module)

1.2.1Basic Drawing

(1)line()ellipse()rectangle()circle() fillPoly()

1.2.2Random generator and text with OpenCV

(随机数生成器cv::RNG 和文字绘制cv::putText的使用方法

1.2.3Smoothing Images

blur()GaussianBlur()medianBlur()bilateralFilter()

1.2.4Eroding and Dilating

cv::erodecv::dilate

1.2.5More Morphology Transformations

Opening、Closing、Morphological Gradient、Top Hat、Black Hat。

1.2.6Hit-or-Miss

Hit-or-Miss 操作

1.2.7Extract horizontal and vertical lines by using morphological operations

使用形态学抽取出直线的的操作例子

1.2.8Image Pyramids

图像金字塔使用pyrUp() 和pyrDown()实现上或者下采样。

1.2.9Basic Thresholding Operations

cv::threshold的使用方法

1.2.10Thresholding Operations using inRange

inRange的使用方法,在HSV空间中根据颜色分割出一个物体。

1.2.11Making your own linear filters!

使用filter2D()创建自己的线性滤波器 

1.2.12Adding borders to your images

 使用copyMakeBorder()进行扩展边界

1.2.13Sobel Derivatives

 Sobel()Scharr()算子的使用方法

1.2.14 Laplace Operator

拉普拉斯变换的操作,在变换结束之后需要使用

convertScaleAbs( dst, abs_dst );// converting back to CV_8U

1.2.15Canny Edge Detector

Canny 边缘检测的使用方法

1.2.16Hough Line Transform

霍夫直线检测

1.2.17Hough Circle Transform

霍夫圆检测

1.2.18Remapping

使用cv::remap实现图像的简单重映射,但是比较麻烦,如何映射需要自己指定。

1.2.19Affine Transformations

使用cv::warpAffine 和cv::getRotationMatrix2D 实现仿射变换

1.2.20Histogram Equalization

直方图均衡化的使用方法

1.2.21Histogram Calculation

(1)split分割图像

  vector<Mat> bgr_planes;
    split( src, bgr_planes );

(2)calcHist 计算直方图

(3)normalize正则化图像

1.2.22Histogram Comparison

使用cv::compareHist对比两个直方图之间的相似度,在对比之前要进行直方图归一化。

1.2.23Back Projection

学习使用直方图在图像中寻找相似物体,主要是cv::calcBackProject 的使用,适用于颜色分割的情况。

详细解释函数的意思:https://blog.csdn.net/keith_bb/article/details/70154219

cv::mixChannels,将部分通道复制到目标图像的部分通道中。

1.2.24Template Matching

模板匹配方法 matchTemplate()

minMaxLoc() 寻找最大最小值

1.2.25Finding contours in your image

先滤波,后canny,最后findcoutors

1.2.26Convex Hull

使用cv::convexHull寻找凸包

1.2.27Creating Bounding boxes and circles for contours

使用cv::boundingRectcv::minEnclosingCircle获取最小矩形和最小圆。

1.2.28Creating Bounding rotated boxes and ellipses for contours

 cv::minAreaRectcv::fitEllipse获得最小包围矩形和最小二乘法拟合的椭圆。

1.2.29Image Moments

(1)cv::moments求轮廓的矩//基于轮廓求得矩

(2) cv::contourArea和 cv::arcLength分别用来求封闭轮廓的面积和周长

1.2.30Point Polygon Test

cv::pointPolygonTest,判断点是否在轮廓内部。

1.2.31Image Segmentation with Distance Transform and Watershed Algorithm

(1)学习的几个函数: cv::filter2Dcv::distanceTransform 、cv::watershed

(2)分水岭图像风格的使用方法

①使用拉普拉斯算法对图像进行锐化,使得边缘更加清晰,有助于分水岭算法的分割,得到imgResult

②使用distanceTransform函数得到分水岭算法的种子点。

③使用cv::watershed进行分割,得到最终结果

1.2.32Out-of-focus Deblur Filter

如何修复失去焦点的图像,通常是由于拍摄时候的抖动。

1.2.33Motion Deblur Filter

学习如何使用维也纳滤波器修复运动模糊的图片。

1.2.34Anisotropic image segmentation by a gradient structure tensor

将学习如何通过梯度结构张量分割具有单个局部方向的各向异性图像。

1.2.35Periodic Noise Removing Filter

学习如何使用傅里叶滤波器去除周期噪声。

1.3 High Level GUI and Media (highgui module)

主要描述Trackbar 的使用方法

1.4Image Input and Output (imgcodecs module)

主要对地理光栅数据的操作。

1.5Video Input and Output (videoio module)

1.5.1Video Input with OpenCV and similarity measurement

(1)如何打卡和读取video类型的数据

(2)对两个图像的相似度进行对比PSNR和SSIM

1.5.2Creating a video with OpenCV

使用opencv创建一个video

1.6Camera calibration and 3D reconstruction (calib3d module)

1.6.1Create calibration pattern

创建校准模式,棋盘或者圆圈。

1.6.2Camera calibration with square chessboard

如何私用棋盘标定相机。

1..6.3Camera calibration With OpenCV

(1)计算畸变矩阵

(2)计算相机矩阵

(3)从相机、视频、图像序列中获取输入

(4)读取和保持XML/YAML

(5)计算重投影矩阵

1.6.4Real Time pose estimation of a textured object

利用3D模型实时的估计当前视频中物体的姿态。

1.6.5Interactive camera calibration application

1.72D Features framework (feature2d module)

1.7.1Harris corner detector

(1)读入图片

(2)检测角点

cornerHarris( src_gray, dst, blockSize, apertureSize, k );

(3)转换为可显示图像

Mat dst_norm, dst_norm_scaled;

normalize( dst, dst_norm, 0, 255, NORM_MINMAX, CV_32FC1, Mat() );

convertScaleAbs( dst_norm, dst_norm_scaled );

(4)绘制角点

1.7.2Shi-Tomasi corner detector

主要使用goodFeaturesToTrack来检测角点

1.7.3Creating your own corner detector

主要使用cv::cornerEigenValsAndVecscv::cornerMinEigenVal

1.7.4Detecting corners location in subpixels

在像素角度检测的基础上,再使用cornerSubPix使得角点检测精度更高。

1.7.5Feature Detection

 cv::FeatureDetector检测特征可以使用SURF ,ORB和KAZE等

1.7.6Feature Description

(1)检测特征并组合成为特征描述子

(2)然后特征描数子进行匹配

(3)绘制匹配情况。drawMatches

1.7.8Feature Matching with FLANN

FLANN是一种匹配方法,通过案例实现了更加准确的匹配。

1.7.9Features2D + Homography to find a known object

实现利用已知的物体从现有图像中分割出来。

cv::findHomography、 cv::perspectiveTransform

1.7.10Detection of planar objects

在一副图像中检测平面物体。

1.7.11AKAZE local features matching

AKAZE 特征描述子的使用

1.7.12AKAZE and ORB planar tracking

主要讲在视频流中如何使用AKAZE和ORB实现平面物体的跟踪
(1)在第一帧中检测和描述关键点,手动设置物体边界
(2)对于后续的某一帧,检测描述关键点,见匹配,估计homography转换矩阵,对匹配进行滤波,使用homography转换矩阵获取物体,最终绘制。

1.7.13Basic concepts of the homography explained with code

homography矩阵介绍

1.8Video analysis (video module)

1.8.1How to Use Background Subtraction Methods

如何分离前景和背景cv::VideoCapture 和 cv::BackgroundSubtractor的使用方法;、

1..8.2Meanshift and Camshift

主要讲了Meanshift和8Meanshift做物体跟踪的方法

使用函数cvtColorinRangecalcHisnormalizemeanShift

1.8.3Optical Flow

光流法的使用

cartToPolar

calcOpticalFlowFarneback

hsv.convertTo(hsv8, CV_8U, 255.0);

cvtColor(hsv8, bgr, COLOR_HSV2BGR);

1.9Video analysis (video module)

1.9.1Cascade Classifier

检测人眼和人脸

cv::CascadeClassifier::load 加载图像/cv::CascadeClassifier::detectMultiScale执行检测

adaboost的做法

1.9.2Cascade Classifier Training

级联分类器的训练、

1.10Deep Neural Networks (dnn module)

1.10.1Load Caffe framework models

使用opencv_dnn模 块加载使用caffe训练的模型

1.10.2How to enable Halide backend for improve efficiency

在opencv中如何使用Halide后端

1.10.3How to run deep networks on Android device

在安卓设备上运行深度学习网络

1.10.4YOLO DNNs

1.10.5How to run deep networks in browser

在浏览器中使用Opencv

1.11 Machine Learning (ml module)

1..11.1Introduction to Support Vector Machines

SVM的训练以及预测使用方法,主要针对线性模型

1.11.2Support Vector Machines for Non-Linearly Separable Data

针对非线性可分数据的支持向量机使用

(1)rowRangecolRange的使用

(2)RNG对fill函数的使用,可以对mat进行数据填充

1.11.3Introduction to Principal Component Analysis (PCA)

使用cv::PCA计算对象的方向,PCA主要是用来降纬的

1.12Graph API (gapi module)

如何定义图运算

(1)inRange对多通道数据进行阈值化

(2)normalize,对图像的像素大小进行缩放

1.13Computational photography (photo module)

高动态范围图像的处理

1.14Images stitching (stitching module)

全景图像拼接cv::Stitcher

1.15GPU-Accelerated Computer Vision (cuda module)

如何使用gpu加速

1.16OpenCV iOS

opencv在ios设备上的使用

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值