資源簡介
該工程是opencv提取障礙物輪廓,然后進行多邊形近似,之后為了設置安全距離,對多邊形頂點進行外擴,最后連成直線并顯示出來。
原理以及效果見博客https://blog.csdn.net/hjk61314/article/details/82112610
代碼片段和文件信息
#include?
#include?
#include?
#include?
using?namespace?std;
using?namespace?cv;
//Ref?多邊形或輪廓等距離外擴或收縮
//????https://blog.csdn.net/hjk61314/article/details/82112610
void?expand_polygon(vector?&orignal?vector?&out);
int?main()
{
????Mat?im?=?imread(“../test.png“?0);
????Mat?cont?=?im.clone();
????Mat?original?=?Mat::zeros(im.rows?im.cols?CV_8UC3);
????Mat?smoothed?=?Mat::zeros(im.rows?im.cols?CV_8UC3);
????imshow(“raw“im);
????//?contour?smoothing?parameters?for?gaussian?filter
????int?filterRadius?=?5;
????int?filterSize?=?2?*?filterRadius?+?1;
????double?sigma?=?10;
????vector?>?contourscontours_new;
????vector?hierarchy;
????//?find?external?contours?and?store?all?contour?points
????findCont
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-08-27?09:33??contourSmooth\
?????文件????????2789??2018-08-22?07:09??contourSmooth\test.png
?????文件?????????333??2018-08-22?07:18??contourSmooth\CMakeLists.txt
?????文件????????5485??2018-08-27?09:32??contourSmooth\main.cpp
評論
共有 條評論