Table of Contents

Method ConvexityDefects

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

ConvexityDefects(InputArray, InputArray, OutputArray)

Computes the contour convexity defects

public static void ConvexityDefects(InputArray contour, InputArray convexHull, OutputArray convexityDefects)

Parameters

contour InputArray

Input contour.

convexHull InputArray

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

convexityDefects OutputArray

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.

ConvexityDefects(IEnumerable<Point>, IEnumerable<int>)

Computes the contour convexity defects

public static Vec4i[] ConvexityDefects(IEnumerable<Point> contour, IEnumerable<int> convexHull)

Parameters

contour IEnumerable<Point>

Input contour.

convexHull IEnumerable<int>

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

Returns

Vec4i[]

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.

ConvexityDefects(IEnumerable<Point2f>, IEnumerable<int>)

Computes the contour convexity defects

public static Vec4i[] ConvexityDefects(IEnumerable<Point2f> contour, IEnumerable<int> convexHull)

Parameters

contour IEnumerable<Point2f>

Input contour.

convexHull IEnumerable<int>

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

Returns

Vec4i[]

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.