convexity-defects

How Convexity Defect is calculated in OpenCV?

只谈情不闲聊 提交于 2019-12-23 20:17:26
问题 What is the algorithm used in OpenCV function convexityDefects() to calculate the convexity defects of a contour? Please, describe and illustrate the high-level operation of the algorithm, along with its inputs and outputs. 回答1: Based on the documentation, the input are two lists of coordinates: contour defining the original contour (red on the image below) convexhull defining the convex hull corresponding to that contour (blue on the image below) The algorithm works in the following manner:

OpenCV Java convexity defects (Computer Vision)

泄露秘密 提交于 2019-12-11 08:59:17
问题 I have a problem with putting my convexity defects on the frame. To calculate them, I modified c++ source and this is what i archived: mConvexityDefectsMatOfInt4 = new MatOfInt4(); if(contours.size() > 0 && convexHullMatOfInt.rows() > 0) Imgproc.convexityDefects(contours.get(0), convexHullMatOfInt, mConvexityDefectsMatOfInt4); However, the Imgproc.drawContours(...) method requires that convexityDefects passed to it as a parameters will be ArrayList. I don't know how can I make the conversion.

How to crop away convexity defects?

折月煮酒 提交于 2019-11-27 04:17:46
I'm trying to detect and fine-locate some objects in images from contours. The contours that I get often include some noise (maybe form the background, I don't know). The objects should look similar to rectangles or squares like: I get very good results with shape matching ( cv::matchShapes ) to detect contours with those objects in them, with and without noise, but I have problems with the fine-location in case of noise. Noise looks like: or for example. My idea was to find convexity defects and if they become too strong, somehow crop away the part that leads to concavity. Detecting the

How to crop away convexity defects?

不问归期 提交于 2019-11-26 12:43:43
问题 I\'m trying to detect and fine-locate some objects in images from contours. The contours that I get often include some noise (maybe form the background, I don\'t know). The objects should look similar to rectangles or squares like: I get very good results with shape matching ( cv::matchShapes ) to detect contours with those objects in them, with and without noise, but I have problems with the fine-location in case of noise. Noise looks like: or for example. My idea was to find convexity