Extract Array of Coordinates from Line (C++ OpenCV)

后端 未结 2 1482
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-21 06:10

Using C++ / OpenCV I\'ve drawn a line on an image using cv::line and now I\'m trying to extract an array of its coordinates. I\'ve tried assigning the line to <

2条回答
  •  猫巷女王i
    2020-12-21 06:12

    You can see this answer. I presume this is what your question needs, Finding points in a line.

    Opencv has Line Iterator function. Go through the documentation!

    Here is a sample usage!

    LineIterator it(img, pt1, pt2, 8);
    for(int i = 0; i < it.count; i++, ++it)
    {
        Point pt= it.pos(); 
       //Draw Some stuff using that Point pt
    }
    

提交回复
热议问题