Currently I am figuring out how can we convert directly opencv object to blob without using canvas? Any help here
berak
January 10, 2022, 7:26am
#2
which kind of blob
are you talking about ? please explain !
Image blob. Currently I am writing opencv object into canvas usingimshow
and then converting blob using toBlob()
. If there is a way in opencv which would directly convert images without using canvas.
berak
January 10, 2022, 8:07am
#4
what do you want to do with it ?
would ImageData do the trick ?
you could look at the imshow() code:
break;
case cv.CV_8UC3:
cv.cvtColor(img, img, cv.COLOR_RGB2RGBA);
break;
case cv.CV_8UC4:
break;
default:
throw new Error('Bad number of channels (Source image must have 1, 3 or 4 channels)');
return;
}
var imgData = new ImageData(new Uint8ClampedArray(img.data), img.cols, img.rows);
var ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
canvas.width = imgData.width;
canvas.height = imgData.height;
ctx.putImageData(imgData, 0, 0);
img.delete();
};
Module['VideoCapture'] = function(videoSource) {
var video = null;