Calculating convexityDefects using OpenCV 2.4 in c++

后端 未结 4 1731
时光取名叫无心
时光取名叫无心 2020-11-30 12:21

I\'m using OpenCV 2.4 to calculate the convex hull of a image.

I\'m also doing some processing to remove some noise from the image, which is not really relevant to

4条回答
  •  长情又很酷
    2020-11-30 12:27

    I've been having the same error for a while until the solution was presented to me. Just check the size of contours[i] before calling convexityDefects

    /// Find the convex hull object for each contour
    vector > hullsI(contours.size());
    vector > hullsP(contours.size());
    vector > defects(contours.size());
    
    for(int i = 0; i 3 )
        {
            convexityDefects(contours[i], hullsI[i], defects[i]);            
        }
    
    }
    

    Hope it helps :)

提交回复
热议问题