I am trying to create a binary hand mask base on this article : https://medium.com/@muehler.v/simple-hand-gesture-recognition-using-opencv-and-javascript-eb3d6ced28a0
But I use a new version of openCV compiled as JavaScript for web browsers. In my openCV version cv.Vector not exsists. I don't know how to replace the cv.Vector function. I have been trying to rewrite functions skinColorUpper, skinColorLower. However, the effect is not satisfactory. How can I write these functions correctly?
const canvasInput = document.getElementById("canvasInput");
const canvasOutput = document.getElementById("canvasOutput");
const skinColorUpper = (hue) => new cv.Mat(1, 1, cv.CV_8UC4,new cv.Scalar(hue,0.8 * 255, 0.6 * 255));
const skinColorLower = (hue) => new cv.Mat(1, 1, cv.CV_8UC4,new cv.Scalar(hue,0.1 * 255, 0.05 * 255));
const img = cv.imread(canvasInput);
cv.cvtColor( img, imgHLS, cv.COLOR_BGR2HLS);
const rangeMask = new cv.Mat();
const up = skinColorUpper(15);
const low = skinColorLower(0);
cv.inRange(imgHLS, low, up, rangeMask);
cv.imshow(canvasOutput, rangeMask);
Input: input image
HLS: HLS image
Output: output mask
Aucun commentaire:
Enregistrer un commentaire