问题
I tried to use OpenCV
Transparent API
UMat
class for hardware acceleration in my desktop java application but I couldn't find the UMat
class implementation. I'm using OpenCV version 4.1
, where T-API
java bindings are said to be available up from version 3.0
as said here:
T-API (transparent API) has been introduced, this is transparent GPU acceleration layer using OpenCL. It does not add any compile-time or runtime dependency of OpenCL. When OpenCL is available, it’s detected and used, but it can be disabled at compile time or at runtime. It covers ~100 OpenCV functions. This work has been done by contract and with generous support from AMD and Intel companies.
- Is
T-API
deprecated? If yes, what replaces it? - And by the way what is the
OpenCV Graph API
G-API? Is it a replacement for theT-API
?
回答1:
Let's break this question down.
Is T-API deprecated? If yes, what replaces it?
No, T-API is not effectively deprecated. You can see it here, that the T-API is still alive under the OpenCV 4.1.2 version tag. Your main issue is that there is no actual Java wrapper for the T-API, as we can see at this answer and we can't see a UMat implementation under the OpenCV Java Docs.
And by the way what is the OpenCV Graph API G-API? Is it a replacement for the T-API?
Again, looking at the docs, we read:
OpenCV 3.0 introduced Transparent API (or T-API) which allowed to offload OpenCV function calls transparently to OpenCL devices and save on Host/Device data transfers with cv::UMat – and it was a great step forward. However, T-API is a dynamic API – user code still remains unconstrained and OpenCL kernels are enqueued in arbitrary order, thus eliminating further pipeline-level optimization potential. G-API brings implicit graph model to OpenCV 4.0. Graph model captures all operations and its data dependencies in a pipeline and so provides G-API framework with extra information to do pipeline-level optimizations.
As it is documented, the G-API doesn't seems to be a "replacement", but more like and improvement of the OpenCV hardware accelerating initiatives. Instead of having just some optimized operations over unorganized kernels, G-API brings a pipe-line/graph oriented paradigm to the newer versions of OpenCV.
来源:https://stackoverflow.com/questions/58957673/opencv-transparent-api-umat-is-missing