Sunday, June 14, 2015

OpenVx for Android - ovx4android

OpenVX is a new Khronos specification for an API for hardware-accelerated computer vision.
The Khronos OpenVX homepage describes it such:

OpenVX is an open, royalty-free standard for cross platform acceleration of computer vision applications. OpenVX enables performance and power-optimized computer vision processing, especially important in embedded and real-time uses cases such as face, body and gesture tracking, smart video surveillance, advanced driver assistance systems (ADAS), object and scene reconstruction, augmented reality, visual inspection, robotics and more.

The OpenVX specification and sample code for download are available here.
Unfortunately, Khronos didn't bother testing their release on Android and it doesn't even compile.  I went ahead and made the necessary changes to compile the code with NDK (I tested with NDKr9d) and I've made it available on github.

In a future post I'll describe how to integrate this with android.hardware.camera2.
I hope you enjoy experimenting with this.
Neta

4 comments:

  1. Hello! What can you say about acceleration on armv7 Android devices? It's much more fast in contrast with
    OpenCV for android? I try example of appliction https://play.google.com/store/apps/details?id=com.machineswithvision.vxview developed by "machines with vision" on my samsung A3. It makes simle canny edged detection and I see big lag from real time. On the other hand OpenCV also have example with edge detector and it seems works faster.

    ReplyDelete
  2. Hi Vladimir,
    The Khronos reference implementation of OpenVX is very far away from being performance-optimized, and this is part of the reason that you see the large lag time. Beyond the fact that this is a reference implementation (required for the ratification of the standard), I think that most of the companies involved in the OpenVX standard view it as a low-level API which is meant to be accelerated by hardware like a GPU or some other specialized accelerator. Therefore, none of these companies has any incentive in providing an optimized implementation, especially for the ARM architecture.
    The sad thing is that Android's developer API has almost no computer vision functionality. There's face detection and a few Renderscript intrinsics, but really, Google, you can do better, I don't really no why Google isn't working to provide such an API because I think it can open up a whole class of applications. If the problem was the lack of a single standard API for hardware-accelerated CV, like OpenGL for graphics, then OpenVX should have done the trick. Not that Google really needs a standard to get all of its SoC vendors to roundup around a new API (e.g. Renderscript vs. OpenCL). Maybe they just don't think an Android CV API is needed,
    Cheers,
    Neta

    ReplyDelete
  3. Hi Neta, when update your post? I'm waiting you !!!

    ReplyDelete