- Wrote the documentation for the minEnclosingTriangle function (+1 extra picture depicting a sample output)

pull/1470/head
Ovidiu Parvu 11 years ago
parent 8bada4c751
commit caaa9e0f2d
  1. BIN
      modules/imgproc/doc/pics/minenclosingtriangle.png
  2. 39
      modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -560,6 +560,41 @@ The function finds the four vertices of a rotated rectangle. This function is us
minEnclosingTriangle
----------------------
Finds a triangle of minimum area enclosing a 2D point set.
.. ocv:function:: void minEnclosingTriangle( InputArray points, OutputArray triangle )
.. ocv:function:: void minEnclosingTriangle( InputArray points, OutputArray triangle, double &area )
.. ocv:pyfunction:: cv2.minEnclosingTriangle(points[, triangle]) -> triangle, area
:param points: Input vector of 2D points with depth ``CV_32S`` or ``CV_32F``.
:param triangle: Output vector of three 2D points defining the vertices of the triangle. The depth of the OutputArray must be ``CV_32F``.
:param area: The area of the minimum enclosing triangle.
The output for a given 2D point set is shown in the image below. The 2D points are depicted in *red* and the enclosing triangle in *yellow*.
.. image:: pics/minenclosingtriangle.png
:height: 250px
:width: 250px
:alt: Sample output of the minimum enclosing triangle function
The implementation of the algorithm is based on O'Rourke's [ORourke86]_ and Klee and Laskowski's [KleeLaskowski85]_ papers. O'Rourke provides a
:math:`\theta(n)`
algorithm for finding the minimal enclosing triangle of a 2D convex polygon with ``n`` vertices. Since the :ocv:func:`minEnclosingTriangle` function takes a 2D point set as input an additional preprocessing step of computing the convex hull of the 2D point set is required. The complexity of the :ocv:func:`convexHull` function is
:math:`O(n log(n))` which is higher than
:math:`\theta(n)`.
Thus the overall complexity of the function is
:math:`O(n log(n))`.
.. note:: See ``opencv_source/samples/cpp/minarea.cpp`` for a usage example.
minEnclosingCircle
----------------------
Finds a circle of the minimum area enclosing a 2D point set.
@ -672,6 +707,10 @@ See below a sample output of the function where each image pixel is tested again
.. [Hu62] M. Hu. *Visual Pattern Recognition by Moment Invariants*, IRE Transactions on Information Theory, 8:2, pp. 179-187, 1962.
.. [KleeLaskowski85] Klee, V. and Laskowski, M.C., *Finding the smallest triangles containing a given convex polygon*, Journal of Algorithms, vol. 6, no. 3, pp. 359–375 (1985)
.. [ORourke86] O’Rourke, J., Aggarwal, A., Maddila, S., and Baldwin, M., *An optimal algorithm for finding minimal enclosing triangles*, Journal of Algorithms, vol. 7, no. 2, pp. 258–269 (1986)
.. [Sklansky82] Sklansky, J., *Finding the Convex Hull of a Simple Polygon*. PRL 1 $number, pp 79-83 (1982)
.. [Suzuki85] Suzuki, S. and Abe, K., *Topological Structural Analysis of Digitized Binary Images by Border Following*. CVGIP 30 1, pp 32-46 (1985)

Loading…
Cancel
Save