29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
#ifndef LINE_CONTINUITY_DETECTION_H
|
||
#define LINE_CONTINUITY_DETECTION_H
|
||
|
||
#include <opencv2/opencv.hpp>
|
||
|
||
class LineContinuityDetection
|
||
{
|
||
public:
|
||
LineContinuityDetection();
|
||
|
||
static bool isContinuous(const cv::Mat& image, double area_threshold = 100);
|
||
|
||
private:
|
||
/// <summary>
|
||
/// 获取连通区域轮廓
|
||
/// </summary>
|
||
/// <param name="src">源图像</param>
|
||
/// <param name="contours">结果轮廓集</param>
|
||
/// <param name="hierarchy">轮廓集的排序关系。与contours的数量对应,受retr选项不同,排序会有变化</param>
|
||
/// <param name="retr">轮廓集排序方式,默认为链式排序</param>
|
||
/// <param name="method">查找算法选择,默认为普通查找</param>
|
||
/// <param name="offset">查找起始点,默认为(0,0)点</param>
|
||
static void myFindContours(const cv::Mat& src, std::vector<std::vector<cv::Point>>& contours, std::vector<cv::Vec4i>& hierarchy,
|
||
int retr = cv::RETR_LIST, int method = cv::CHAIN_APPROX_SIMPLE, cv::Point offset = cv::Point(0, 0));
|
||
|
||
static bool findBlock(const std::vector<std::vector<cv::Point>>& contours, const std::vector<cv::Vec4i>& hierarchy, double area_threshold);
|
||
};
|
||
|
||
#endif //LINE_CONTINUITY_DETECTION_H
|