Skip to content

Consolidating Contours Tutorials #17245

@boubascript

Description

@boubascript

As it currently stands, the main OpenCV tutorials for the imgproc module contains 6 tutorials on contours:

Finding contours in your image, Convex Hull, Creating Bounding boxes and circles for contours, Creating Bounding rotated boxes and ellipses for contours, Image Moments, Point Polygon Test

The OpenCV-Python tutorials has 5 articles on the same subject. Per the OpenCV Documentation improvement plan and Issue #9520, it sounds like it might be of interest to consolidate these tutorials into a comprehensive set of tutorials with multi-language support in the main collection.

In particular we noticed the following motivating differences:

  • The main tutorials already contain Python code but they are noticeably more complex.
  • The main tutorials do not have the exact same coverage. For example, it does not appear that Contour Approximation - cv.approxPolyDP() is covered in the main tutorials.
  • The main tutorials do not have much in the way of theory, whereas the Python tutorials have much more explanation of the concepts.

Proposed plan:

  • Reorganize all contour related articles in main tutorials to reflect the organization of the Python Tutorials - "Getting Started", "Features", "Properties", "More Functions" and "Hierarchy". (We do not have to use the same exact scheme, thoughts on this would be greatly appreciated)
    • These can become a single subfolder for contours, as in the Python tutorials.
  • Consolidate all relevant information (e.g. theory/explanations) from Python tutorials into the main tutorials
  • Merging Python code samples from Python tutorials and main tutorials

Questions:

  • What is the "official" stance on comments within tutorial code? We have seen, and understand, that truly good tutorial code should not need extensive explanation in snippets or comments, but it is undeniable that comments enhance readability. On the other hand, we have also noticed that there are potential comments - unseen Doxygen comments (ex: see Contours_demo2.cpp) - that we can make visible.
  • Does this Python Samples Style Guide accurately reflect the desired coding style for moving forward? Usage of an "application" for clean handling of globals is good practice, but can produce much more verbose code. In particular, note that what is understandable in 6 lines in Contours: Getting Started requires much more code in OpenCV: Finding contours in your image.
  • It appears that the Python tutorials wrote code samples directly in the articles, rather than referencing sample files under opencv/samples/python. If we are to reconcile the Python code from both sources, should the original code in the main tutorial be preserved as a sample (creating a new sample containing the edited code), or should we simply overwrite the existing sample ?

@dmallia17 @wongjessica

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions