[−][src]Function opencv::imgproc::convex_hull
pub fn convex_hull(
points: &dyn ToInputArray,
hull: &mut dyn ToOutputArray,
clockwise: bool,
return_points: bool
) -> Result<()>
Finds the convex hull of a point set.
The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm Sklansky82 that has O(N logN) complexity in the current implementation.
Parameters
- points: Input 2D point set, stored in std::vector or Mat.
- hull: Output convex hull. It is either an integer vector of indices or vector of points. In the first case, the hull elements are 0-based indices of the convex hull points in the original array (since the set of convex hull points is a subset of the original point set). In the second case, hull elements are the convex hull points themselves.
- clockwise: Orientation flag. If it is true, the output convex hull is oriented clockwise. Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing to the right, and its Y axis pointing upwards.
- returnPoints: Operation flag. In case of a matrix, when the flag is true, the function returns convex hull points. Otherwise, it returns indices of the convex hull points. When the output array is std::vector, the flag is ignored, and the output depends on the type of the vector: std::vector<int> implies returnPoints=false, std::vector<Point> implies returnPoints=true.
Note: points
and hull
should be different arrays, inplace processing isn't supported.
Check @ref tutorial_hull "the corresponding tutorial" for more details.
useful links:
https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/
C++ default parameters
- clockwise: false
- return_points: true