Ask Your Question

Revision history [back]

For process a line you can use the below code.

code:

void darwLine(InputOutputArray _src,const Point &point1,const Point &point2)
{
   Mat src = _src.getMat();

   LineIterator it = LineIterator(src,point1,point2);
   for (size_t i=0; i < it.count;i++,it++)
   {
       cv::Point cur_point = it.pos();
      src.at<uchar>(cur_point.x,cur_point.y) = 255;

   }
}
void main()
{
    Mat src = Mat::zeros(Size(550,500),CV_8UC1);
    darwLine(src,Point(0,0),Point(100,150));
    imshow("view",src);
    waitKey(0);
}