拟合程序

# include <opencv.hpp>
# include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv){
 Mat src, dst;
 src = imread("E://所有的视频振动//实验1.23//八分之一曝光值//DSC_13811转.jpg");
 if (src.empty()) {
  printf("不存在\n");
  return  -1;
 }
 namedWindow("INPUT_TITLE", CV_WINDOW_NORMAL);
 imshow("INPUT_TITLE", src);
 Mat gray_src;
 cvtColor(src, gray_src, CV_BGR2GRAY);
 namedWindow("OUT_TITLE", CV_WINDOW_NORMAL);
 imshow("OUT_TITLE", gray_src);
 printf("tongdao", gray_src.channels());
 const uchar*firstRow = gray_src.ptr<uchar>(2);
 printf("第一个灰度:%d\n", *firstRow);
 int x = gray_src.rows;
 int y = gray_src.cols;
 printf("x:%d\n y:%d\n", x, y);
 for (int row = 0; row < x; row++){
  for (int col = 0; col < y; col++){
   int m = gray_src.at<uchar>(row, col);
   if (998 < row && row < 1000) {
    if (m = 100){
     uchar **N = new uchar*[gray_src.rows];
     N [row] = gray_src.ptr<uchar>(row);
     uchar **M = new uchar*[gray_src.cols];
     M[col] = gray_src.ptr<uchar>(col);
      printf(" %d\n %d\n", N, M);
      cv::Mat image = cv::Mat::zeros(640, 1200, CV_8UC3);
      //输入拟合点
      std::vector<cv::Point> points;
      points.push_back(cv::Point(col / 3, row / 5));

      //将拟合点绘制到空白图上
      for (int i = 0; i < points.size(); i++)
      {
       cv::circle(image, points[i], 5, cv::Scalar(0, 0, 255), 2, 8, 0);
      }
      cv::Vec4f line_para;
      cv::fitLine(points, line_para, cv::DIST_L2, 0, 1e-2, 1e-2);
      std::cout << "line_para = " << line_para << std::endl;
      //获取点斜式的点和斜率
      cv::Point point0;
      point0.x = line_para[2];
      point0.y = line_para[3];
      double k = line_para[1] / line_para[0];
      //计算直线的端点(y = k(x - x0) + y0)
      cv::Point point1, point2;
      point1.x = 0;
      point1.y = k * (0 - point0.x) + point0.y;
      point2.x = 640;
      point2.y = k * (640 - point0.x) + point0.y;
      cv::line(image, point1, point2, cv::Scalar(0, 255, 0), 2, 8, 0);

      cv::imshow("image", image);
      cv::waitKey(0);
      return 0;
    
    }
   }
  }
 }
 waitKey(0);
 return 0;
}
运行后之拟合了一个点,怎么把所有需要的点都拟合出来@赵四老师