OpenCV官方库解释 :
https://docs.opencv.org/3.4.5/index.html
读取一帧
https://blog.csdn.net/Fan_pgm_v/article/details/79960760
minHessian:
https://blog.csdn.net/zhounanzhaode/article/details/50640312
Ptr<>智能指针:
https://blog.csdn.net/qq_22329695/article/details/70880080
Mat a = imread():
https://blog.csdn.net/ab1322583838/article/details/52048141
http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/core/mat%20-%20the%20basic%20image%20container/mat%20-%20the%20basic%20image%20container.html
https://blog.csdn.net/lyq_12/article/details/84316288
KeyPoint:
https://www.cnblogs.com/my-idiot-days/archive/2013/05/01/3053831.html
DMatch,matches解释:
https://blog.csdn.net/dcrmg/article/details/52614031
https://blog.csdn.net/lihuacui/article/details/56667342
SIFT算法解析:
https://www.cnblogs.com/jsxyhelu/p/7628664.html
https://cloud.tencent.com/developer/article/1419617
https://www.cnblogs.com/little-monkey/p/7625595.html
图像扭曲后变正:
转载:
https://blog.csdn.net/xiaowei_cqu/article/details/26471527
https://blog.csdn.net/xiaowei_cqu/article/details/26471527
https://zhuanlan.zhihu.com/p/24591720
https://blog.csdn.net/MrCharles/article/details/73739693
Rect:
https://blog.csdn.net/wangxuwen2/article/details/51953533
图像旋转任意角度:
https://blog.csdn.net/u013263891/article/details/83932479
边缘检测:
https://blog.csdn.net/t6_17/article/details/78729097
图像变换:
https://blog.csdn.net/weixin_41923000/article/details/88697826
Canny边缘检测:
http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html
findContours轮廓检测:
https://blog.csdn.net/eric_e/article/details/79591025
minAreaRect 找到最小的外接矩形:
https://blog.csdn.net/qq_18343569/article/details/48000179
approxPolyDP 多边拟合函数
https://blog.csdn.net/kakiebu/article/details/79824856
contourArea轮廓面积检测
https://www.jianshu.com/p/23ca6c861153
convexHull凸包检测
https://www.jianshu.com/p/42eb9b3957d5
二值化轮廓提取
https://blog.csdn.net/minghui_/article/details/80501436
骨架提取
https://blog.csdn.net/queatin_man/article/details/52313819
/**
* Code for thinning a binary image using Zhang-Suen algorithm.
*
* Author: Nash (nash [at] opencv-code [dot] com)
* Website: http://opencv-code.com
*/
#include <opencv2/opencv.hpp>
/**
* Perform one thinning iteration.
* Normally you wouldn't call this function directly from your code.
*
* Parameters:
* im Binary image with range = [0,1]
* iter 0=even, 1=odd
*/
void thinningIteration(cv::Mat& img, int iter)
{
CV_Assert(img.channels() == 1);
CV_Assert(img.depth() != sizeof(uchar));
CV_Assert(img.rows > 3 && img.cols > 3);
cv::Mat marker = cv::Mat::zeros(img.size(), CV_8UC1);
int nRows = img.rows;
int nCols = img.cols;
if (img.isContinuous()) {
nCols *= nRows;
nRows = 1;
}
int x, y;
uchar *pAbove;
uchar *pCurr;
uchar *pBelow;
uchar *nw, *no, *ne; // north (pAbove)
uchar *we, *me, *ea;
uchar *sw, *so, *se; // south (pBelow)
uchar *pDst;
// initialize row pointers
pAbove = NULL;
pCurr = img.ptr<uchar>(0);
pBelow = img.ptr<uchar>(1);
for (y = 1; y < img.rows-1; ++y) {
// shift the rows up by one
pAbove = pCurr;
pCurr = pBelow;
pBelow = img.ptr<uchar>(y+1);
pDst = marker.ptr<uchar>(y);
// initialize col pointers
no = &(pAbove[0]);
ne = &(pAbove[1]);
me = &(pCurr[0]);
ea = &(pCurr[1]);
so = &(pBelow[0]);
se = &(pBelow[1]);
for (x = 1; x < img.cols-1; ++x) {
// shift col pointers left by one (scan left to right)
nw = no;
no = ne;
ne = &(pAbove[x+1]);
we = me;
me = ea;
ea = &(pCurr[x+1]);
sw = so;
so = se;
se = &(pBelow[x+1]);
int A = (*no == 0 && *ne == 1) + (*ne == 0 && *ea == 1) +
(*ea == 0 && *se == 1) + (*se == 0 && *so == 1) +
(*so == 0 && *sw == 1) + (*sw == 0 && *we == 1) +
(*we == 0 && *nw == 1) + (*nw == 0 && *no == 1);
int B = *no + *ne + *ea + *se + *so + *sw + *we + *nw;
int m1 = iter == 0 ? (*no * *ea * *so) : (*no * *ea * *we);
int m2 = iter == 0 ? (*ea * *so * *we) : (*no * *so * *we);
if (A == 1 && (B >= 2 && B <= 6) && m1 == 0 && m2 == 0)
pDst[x] = 1;
}
}
img &= ~marker;
}
/**
* Function for thinning the given binary image
*
* Parameters:
* src The source image, binary with range = [0,255]
* dst The destination image
*/
void thinning(const cv::Mat& src, cv::Mat& dst)
{
dst = src.clone();
dst /= 255; // convert to binary image
cv::Mat prev = cv::Mat::zeros(dst.size(), CV_8UC1);
cv::Mat diff;
do {
thinningIteration(dst, 0);
thinningIteration(dst, 1);
cv::absdiff(dst, prev, diff);
dst.copyTo(prev);
}
while (cv::countNonZero(diff) > 0);
dst *= 255;
}
/**
* This is an example on how to call the thinning funciton above
*/
int main()
{
cv::Mat src = cv::imread("image.png");
if (!src.data)
return -1;
cv::Mat bw;
cv::cvtColor(src, bw, CV_BGR2GRAY);
cv::threshold(bw, bw, 10, 255, CV_THRESH_BINARY);
thinning(bw, bw);
cv::imshow("src", src);
cv::imshow("dst", bw);
cv::waitKey();
return 0;
}