boolopencvTool::drawLines(std::string image_p, std::vector<cv::Point> points){cv::Mat ima = cv::imread(image_p.c_str());// 读取图像,替换为你的图片路径 cv::Scalar red = cv::Scalar(0,0,255);// Red color int thickness =2;// 遍历点列表,绘制线段for(size_t i =0; i < points.size()-1; i++){cv::Point2f start = points[i];cv::Point2f end = points[i +1];cv::line(ima, start, end, red, thickness);}cv::imwrite(image_p.c_str(), ima);returntrue;}boolopencvTool::drawLines(cv::Mat& image, std::vector<cv::Point> points,int lineWidth){cv::Scalar red = cv::Scalar(0,0,255);// Red color // 遍历点列表,绘制线段for(size_t i =0; i < points.size()-1; i++){cv::Point2f start = points[i];cv::Point2f end = points[i +1];cv::line(image, start, end, red, lineWidth);}returntrue;}