Problems with finding contour in a video image using C++ FindContours

柔情痞子 提交于 2019-12-04 15:50:22
  1. Since you are using the fact of largest contour so I presume you are trying to detect the largest object appearing in the field of view of the camera.I wonder why the window light/bright light source at top right doesn't create any contour(may be due to blurring). You can store the background image and subtract it from the image where the object appears. This way you can derive the object.You can apply a contour finding in the difference image.absdiff(frame_now,frame_backgrnd,diff) where diff is the difference image.
  2. If the object is in motion and you want to detect you can use optical flow combined with largest contour to detect the object.
  3. Try doing you process without the blurring function and then detect the largest contourArea.
  4. For plotting the points try this

    for(int i = 1;i<(int)largest_contours[0].size();i++)
         line(image,largest_contours[0][i-1],largest_contours[0][i],cv::Scalar(0,0,255),2,8,0);
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!