Ask Your Question

Revision history [back]

The way you created your ranges is incorrect, and initializing a Mat from a 3 column array instead of a 4 column array gives the error

"Incorrect number of tuple elements for Scalar: expected=4, actual=3",

The way to create the range works through using the factory method matFromArray(). the ranges must be created by

const low = cv.matFromArray(hsv.rows, hsv.cols, hsv.type(), lower_white);

instead of

const low = new cv.Mat(hsv.rows, hsv.cols, hsv.type(), lower_white);