node-opencv icon indicating copy to clipboard operation
node-opencv copied to clipboard

Opinion: Do you want GPU processing?

Open salmanulhaq opened this issue 9 years ago • 6 comments

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!

salmanulhaq avatar Mar 14 '16 13:03 salmanulhaq

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).

  • http://www.learnopencv.com/opencv-transparent-api/
  • http://stackoverflow.com/questions/33602675/what-is-the-difference-between-umat-and-mat-in-opencv

mvines avatar Mar 14 '16 15:03 mvines

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.

salmanulhaq avatar Mar 14 '16 15:03 salmanulhaq

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.

peterbraden avatar Mar 22 '16 12:03 peterbraden

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(...);
});

salmanulhaq avatar Mar 22 '16 12:03 salmanulhaq

Would love to have OpenCL support!

mgcrea avatar Apr 05 '16 14:04 mgcrea

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

skolesnyk avatar Mar 06 '17 11:03 skolesnyk