justadudewhohacks / justadudewhohacks/opencv4nodejs

Wrong declaration of Mat.drawContoures( ) should be fixed

Open
#691 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.1k
Forks
826
PR merge metrics
No merged PRs in 30d

Description

I'm using 5.5.0, thanks to :https://overflowjs.com/posts/Image-Processing-OpenCV-and-Nodejs-Part-3.html
The following code works:
```
let contours = grayImage.findContours(cv.RETR_TREE, cv.CHAIN_APPROX_NONE, new cv.Point2(0, 0));
const color = new cv.Vec3(41, 176, 218);
contours = contours.sort((c0, c1) => c1.area - c0.area);
const imgContours = contours.map((contour) => {
return contour.getPoints();
});
this.image.drawContours(imgContours, -1, color, 2);
```
however the declaration of findCoutours in lib/typings/Mat.d.ts is like (#135)
` drawContours(contours: Contour[], color: Vec3, contourIdx?: number, maxLevel?: number, offset?: Point2, lineType?: number, thickness?: number, shift?: number): void;
`
and the functiion in native opencv delared like:

void cv::drawContours | ( | InputOutputArray | image,
-- | -- | -- | --
  |   | InputArrayOfArrays | contours,
  |   | int | contourIdx,
  |   | const Scalar & | color,
  |   | int | thickness = 1,
  |   | int | lineType = LINE_8,
  |   | InputArray | hierarchy = noArray(),
  |   | int | maxLevel = INT_MAX,
  |   | Point | offset = Point()
  | ) |   |  

not only the first parameter is wrong and the follwing parameters are declared in wrong order
it should be fixed as a BUG I think.
anybody confirm that ?

*OpenCV version* (example 3.4.1): 4.2.0

*With OpenCV-contrib?* (extra modules): no

*OS*: MacOSX ...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.