opencv4nodejs icon indicating copy to clipboard operation
opencv4nodejs copied to clipboard

Async version of VideoCapture

Open dreambit opened this issue 6 years ago • 3 comments

Is there a non blocking version of VideoCapture(or plans to implement)? Right now the only way to leverage all cpus is to use cluster module. Thanks.

dreambit avatar May 29 '19 18:05 dreambit

Yes, you can use cap.readAsync().

justadudewhohacks avatar Jun 19 '19 10:06 justadudewhohacks

@justadudewhohacks Hi I mean this:

const vc = new cv.VideoCapture(http url);
const mat = await vc.readAsync();

new cv.VideoCapture(http url) is blocking, for me it take ~3 seconds to complete.

Is it possible to make it async?

dreambit avatar Jun 19 '19 14:06 dreambit

@justadudewhohacks Hi I mean this:

const vc = new cv.VideoCapture(http url);
const mat = await vc.readAsync();

new cv.VideoCapture(http url) is blocking, for me it take ~3 seconds to complete.

Is it possible to make it async?

I have the same problem, the unique way seems to use it in external process or workers but is a bit tricky and not so elegant. I'm tempted to use Python instead of using OpenCV in this way...

PaserSRL avatar May 17 '24 08:05 PaserSRL