opencv检测相交点_OpenCV:曲线的检测与提取-0
//尋找曲線 :
void findLines(Mat &binaryImg, vector> &outLines)
{
//八鄰域
vector neighborPtVec;
neighborPtVec.push_back(Point(-1,-1));
neighborPtVec.push_back(Point(0,-1));
neighborPtVec.push_back(Point(1,-1));
neighborPtVec.push_back(Point(1,0));
neighborPtVec.push_back(Point(1,1));
neighborPtVec.push_back(Point(0,1));
neighborPtVec.push_back(Point(-1,1));
neighborPtVec.push_back(Point(-1,0));
Point firstPt;
while (findFirstPoint(binaryImg, firstPt))
{
deque line;//點的隊列
line.push_back(firstPt);//存儲第一個點
//由于第一個點不一定是線段的起始位置,
//因此兩個方向都要查找
Point currPt = firstPt;//當前點
int currFlag = 0;//標志
Point nextPt;//下一個點
int nextFlag;//下一點的標志
while (findNextPoint(neighborPtVec, binaryImg, currPt, currFlag, nextPt, nextFlag))//一端
{
line.push_back(nextPt);//壓入隊列
currPt = nextPt;
currFlag = nextFlag;
}
//找另一端
currPt = firstPt;
currFlag = 0;
while (findNextPoint(neighborPtVec, binaryImg, currPt, currFlag, nextPt, nextFlag))
{
line.push_front(nextPt);
currPt = nextPt;
currFlag = nextFlag;//鄰域與中心像素的位置
}
if (line.size() > 10)
{
outLines.push_back(line);
}
}
}
總結(jié)
以上是生活随笔為你收集整理的opencv检测相交点_OpenCV:曲线的检测与提取-0的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vba 判断文本框内容是否为空_【VBA
- 下一篇: 妖怪手帐获取服务器信息失败,妖怪手账闪退