A python wrapper for the minimal area enclosing triangle algorithm available here, which was included in OpenCV. This wrapper is adapted from the OpenCV implementation.
- python >= 3.6
- pybind11 >= 2.3.0
pip install .
In python import the module and use the compute method to compute the minimal area enclosing triangle.
import numpy as np
import pymintriangle
from scipy.spatial import ConvexHull
points = np.random.rand(20, 2)
convex_hull = ConvexHull(points)
triangle = pymintriangle.compute(points[convex_hull.vertices])
Computes the minimal area triangle of set of points making a convex hull.
- convexHull : (Mx2) array
- The coordinates of the points making the convex hull.
- triangle : (3x2) array
- The coordinates of the points of the triangle.