I want to convert a list of points to contours (similar to the contours returned by findContours in opencv.js). I'm thinking something like this:
let points = [[10,10],[100,10],[100,100],[10,100]]
var contours = new cv.MatVector();
for (var i = 0; i < points.length; ++i) {
contours.push_back(new cv.Mat(points[i][0], points[i][1]))
}
But it is throwing me following error;
TypeError: right-hand side of 'in' should be an object, got number
Didn't understand what where you trying to do with the contours, but googling similar error brought me here.
cv.Mat
constractor requires two arguments: the first is cv.Size
of the mat, and the type of the cells of the resulting Mat(e,g: cv.CV_8UC1
).
let points = [[10,10],[100,10],[100,100],[10,100]];
var contours = new cv.MatVector();
for (var i = 0; i < points.length; ++i) {
contours.push_back(new cv.Mat(points[i][0], points[i][1]), ));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.