peterbraden / node-opencv

OpenCV Bindings for node.js
MIT License
4.38k stars 858 forks source link

Opinion: Do you want GPU processing? #388

Open salmanulhaq opened 8 years ago

salmanulhaq commented 8 years ago

Hello community,

I've been wondering this for a while now. I want to gauge demand for adding GPU support for some of the more compute intensive functions in node-opencv. For example, GPU processing can accelerate face detection and even resizing very large images etc. Would that be valuable?

I'll consider contributing GPU support if there's enough interest.

Thanks!

mvines commented 8 years ago

Yes please! Adding support for OpenCV 3's UMat matrix API would be a great start, although we still need to retain compatibility with OpenCV 2 (where UMat is not available).

salmanulhaq commented 8 years ago

I'd recommend sticking to Mat since UMat (a quick glance at the links you shared) shows it supports OpenCL but does not mention CUDA where NVIDIA GPUs are available.

peterbraden commented 8 years ago

This would be awesome, but is there a way to target both CUDA and OpenCL?

I don't know much about it, but definitely think it would be cool.

salmanulhaq commented 8 years ago

Unfortunately CUDA and OpenCL implementations of OpenCV's functions are not unified i.e. we'd have to call them separately. Ideally, I was thinking about a wrapper which determined what GPU is available and then executes accordingly, something like this:

var opencv = require('opencv')('ACCELERATED'); //check what accelerator is available (CUDA for NVIDIA GPU, OpenCL for AMD and default CPU implementation for Intel CPU) and use it for processing, wherever possible
opencv.readImage(/image/path, function(err,img){
   img.resize(...);
});
mgcrea commented 8 years ago

Would love to have OpenCL support!

skolesnyk commented 7 years ago

An absolute must! Could you create a chip-in so we would be able to financially contribute to development? It's been almost year since you've started this thread.

Btw, take a look at how cuda/non cuda functions are called in the example here. https://github.com/opencv/opencv/blob/master/samples/gpu/generalized_hough.cpp . Looks like cuda support is already in OpenCV 2.4