int delta_line(const cv::Mat& _src, const int width, const int height, vector& lines) { lines.clear(); cv::Mat src; cv::GaussianBlur(_src, src, { BW, BW }, 5.0); cv::GaussianBlur(src, src, { BW, BW }, 5.0); cv::Mat dst, color_dst; cv::Canny(src, dst, 50, 200, 3); cv::morphologyEx(dst, dst, cv::MORPH_BLACKHAT, cv::Mat::ones(9, 9, CV_8U)); cv::HoughLinesP(dst, lines, 2, CV_PI / 180, 80, height / 3.0, 10); if (lines.size() > 0) { int x1, x2, y1, y2, y3; x1 = lines[0][0]; x2 = lines[0][2]; y1 = lines[0][1]; y2 = lines[0][3]; y3 = height >> 1; int x3 = (int)(y3 - y2)*(x1 - x2) / (y1 - y2 + EPS) + x2; return (x3 - (width >> 1));// ×ó + ÓÒ } else return 0; }