Repository: opencv
Issue: Multiple functions for polygon drawing
Labels: auto-transferred,feature,priority: low,category: core

Transferred from http://code.opencv.org/issues/2573

```
|| Michael Burdinov on 2012-11-27 06:19
|| Priority: Low
|| Affected: None
|| Category: core
|| Tracker: Feature
|| Difficulty: None
|| PR: None
|| Platform: None / None
```
## Multiple functions for polygon drawing

```
fillPoly, polylines, and drawContours are designed to do the same task: draw set of polygons in image. They have minor differences but it is still unclear why there 3 functions instead of one. There no documentation that compare them, so I don't even know whether each one has its own implementation or they share some code.

Kirill Kornyakov: 
Suggestion is to get rid of two of them and to stay with only one.
```
## History
##### Kirill Kornyakov on 2012-11-27 10:34

```
OK, but what exactly is needed here?

If the one is interested in inter-dependency of this functions, he can read the code. If you want to see some explanation in the documentation, then please point which pages should be updated and with which text. It is also possible that you could make a pull request to the documentation, to simplify the whole procedure. OpenCV project doesn't have a dedicated technical writer, so it may take forever...
-   Target version set to Next Hackathon
-   Assignee changed from Vadim Pisarevsky to Michael Burdinov
-   Category changed from core to documentation
```
##### Michael Burdinov on 2012-11-27 14:37

```
This is not issue of documentation (at least not only documentation). Someone has to decide which one of the 3 functions is the most correct / has best interface / fastest / is supported / and so on. Two other functions should be deprecated. Or maybe some new interface should be created that will unify all 3 interfaces, and existing ones will all be depricated. I just pointed out that having 3 different functions with nearly identical functionality is very confusing. At least I don't know the answer to the question: which function should be used.
```
##### Kirill Kornyakov on 2012-11-28 07:47

```
OK, let Vadim decide. Functions are indeed quite similar, so we'll probably get rid of some of them during the next restucturing.

Here are functions' signatures to think about:

* "fillPoly":http://docs.opencv.org/modules/core/doc/drawing_functions.html?highlight=fillpoly#cv.FillPoly
* "polylines":http://docs.opencv.org/modules/core/doc/drawing_functions.html?highlight=polylines#cv2.polylines
* "drawContours":http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=drawcontours#cv.DrawContours

<pre>
void polylines(Mat& img, const Point** pts, const int* npts, int ncontours, bool isClosed, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )
void  fillPoly(Mat& img, const Point** pts, const int* npts, int ncontours, const Scalar& color, int lineType=8, int shift=0, Point offset=Point() )
void drawContours(InputOutputArray image, InputArrayOfArrays contours, int contourIdx, const Scalar& color, int thickness=1, int lineType=8, InputArray hierarchy=noArray(), int maxLevel=INT_MAX, Point offset=Point() )
</pre>
-   Target version changed from Next Hackathon to 3.0
-   Priority changed from Normal to Low
-   Description changed from fillPoly, polylines, and drawContours are
    designed to do the same task: draw ... to fillPoly, polylines, and
    drawContours are designed to do the same task: draw ... More
-   Assignee changed from Michael Burdinov to Vadim Pisarevsky
-   Category changed from documentation to core
-   Tracker changed from Patch to Feature
```