Add support for maxLevel

This commit is contained in:
Ollie Relph 2016-10-25 11:28:34 +01:00
parent d3c18389c6
commit 79da65d9a5
2 changed files with 3 additions and 2 deletions

View File

@ -26,6 +26,7 @@ cv.readImage('./files/stuff.png', function(err, im) {
contours = im_canny.findContours(); contours = im_canny.findContours();
const lineType = 8; const lineType = 8;
const maxLevel = 0;
const thickness = 1; const thickness = 1;
for(i = 0; i < contours.size(); i++) { for(i = 0; i < contours.size(); i++) {
@ -33,7 +34,7 @@ cv.readImage('./files/stuff.png', function(err, im) {
var moments = contours.moments(i); var moments = contours.moments(i);
var cgx = Math.round(moments.m10 / moments.m00); var cgx = Math.round(moments.m10 / moments.m00);
var cgy = Math.round(moments.m01 / moments.m00); var cgy = Math.round(moments.m01 / moments.m00);
big.drawContour(contours, i, GREEN, thickness, lineType, [0, 0]); big.drawContour(contours, i, GREEN, thickness, lineType, maxLevel, [0, 0]);
big.line([cgx - 5, cgy], [cgx + 5, cgy], RED); big.line([cgx - 5, cgy], [cgx + 5, cgy], RED);
big.line([cgx, cgy - 5], [cgx, cgy + 5], RED); big.line([cgx, cgy - 5], [cgx, cgy + 5], RED);
} }

View File

@ -1487,7 +1487,7 @@ NAN_METHOD(Matrix::DrawContour) {
int thickness = info.Length() < 4 ? 1 : info[3]->NumberValue(); int thickness = info.Length() < 4 ? 1 : info[3]->NumberValue();
int lineType = info.Length() < 5 ? 8 : info[4]->NumberValue(); int lineType = info.Length() < 5 ? 8 : info[4]->NumberValue();
int maxLevel = 0; int maxLevel = info.Length() < 6 ? 0 : info[5]->NumberValue();
cv::Point offset; cv::Point offset;
if (info.Length() == 6) { if (info.Length() == 6) {