Sorry to bother you with such a basic questions but where should I start (=download) with opencv.js ?
There are some github repos with samples and they're kinda working but as soon as you get past the basic samples (imread, threshold, morphs, edge) then it looks like nothing is working anymore (cannot convert X to Y).
I'd like to run some mser and maybe OCR.
Or maybe I'm just using mser wrong ? Any sample of mser using https://docs.opencv.org/4.0.0/opencv.js ?
What's wrong with
function getInput() {
var canvas = document.getElementById('canvasOutput');
var ctx = canvas.getContext('2d');
var imgData = ctx.getImageData(0,0,canvas.width, canvas.height);
return imgData;
}
var img = cv.matFromArray(getInput(), 24); // 24 for rgba
var img_color = new cv.Mat(); // Opencv likes RGB
cv.cvtColor(img, img_color, cv.ColorConversionCodes.COLOR_RGBA2RGB.value, 0);
img.delete();
// Initiate STAR detector
var mser = new cv.MSER(5, 60, 14400, 0.25, 0.2, 200, 1.01, 0.003, 5);
var contours = new cv.PointVectorVector();
var kp = new cv.KeyPointVector();
var boxes = new cv.RectVector();
mser.detectRegions(img_color, contours, boxes);
...
I'm running Chrome/ubuntu 18.04 if that matters