Skip to content Skip to sidebar Skip to footer

Opencv.js How To Draw A Subset Of Contours?

Using Opencv.js I have acquired the contours in an image. using some selection function I have collected a subset of these contours. Say they are in the list of contours: var suit

Solution 1:

From https://docs.opencv.org/3.4/d5/daa/tutorial_js_contours_begin.html

Try something like this:

let color = new cv.Scalar(255,0,0,255);
for (let i = 0; i < suitableContours.size(); ++i) {
    cv.drawContours(src, suitableContours, i, color, 1, cv.LINE_8, hierarchy, 100);
}
cv.imshow('canvasOutput', src);

Post a Comment for "Opencv.js How To Draw A Subset Of Contours?"