Ask Your Question

What is the best way to setup GPU acceleration on Android?

asked 2013-10-07 14:08:16 -0500

mahabudhi gravatar image

updated 2013-10-07 14:11:45 -0500


I am trying to use OpenCV in my Android development (dev environment is Eclipse-ADT, Mac OS). I am trying to use JPEG 2000 format for image compression, I kind of found that it is slower and I do see .jp2 file generated is bigger than my original .png file (I am setting CV_IMWRITE_JPEG_QUALITY etc). Here is sample code that I am using

    Mat imgMat = new Mat();
    Utils.bitmapToMat(imgBitmap, imgMat);
    MatOfInt params = new MatOfInt(Highgui.CV_IMWRITE_JPEG_QUALITY, 10);

    Mat mIntermediateMat = new Mat();
    Imgproc.cvtColor(imgMat, mIntermediateMat, Imgproc.COLOR_RGBA2BGR, 3);

    boolean writeFlag = Highgui.imwrite(file.toString(), mIntermediateMat, params);

I would like to setup CUDA acceleration on my Android machine and try to improve the performance. Do I need to do a build with CUDA enabled etc or is there a simple binary download available?

Thanks you


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-08 00:58:02 -0500

Moster gravatar image

Do you even know what CUDA is? CUDA is Nvidia's GPGPU platform. You would need a Nvidia graphics card/Soc in your smartphone/tablet that supports this. There is none so far, so you cant use this.

OpenCL is also not an option on android.

edit flag offensive delete link more


Agree I do not know much about CUDA or opencv for android. But I would like to use 'gpu' namespace for my android development, what is the best way to set that up, is there a documentation somewhere.

mahabudhi gravatar imagemahabudhi ( 2013-10-08 11:43:23 -0500 )edit

I just told you that its not possible.

Moster gravatar imageMoster ( 2013-10-08 14:49:37 -0500 )edit

Thank you, so the Android Manager that gets installed has all the HW optimizations for a specific platform. It all started, as I was generating a JPEG 2000 file which was taking longer time than (3x longer) JPEG file generation. I thought I am doing something wrong and lack of understanding of NVIDIA terminology/technology etc lead to a search in wrong direction. Thank you for your help.

mahabudhi gravatar imagemahabudhi ( 2013-10-08 16:04:28 -0500 )edit

The only optimization are NEON instructions that are used for some implementations, but thats it. GPU computing is not really popular on android devices yet. The nvidia tegra 5 will be the first SOC to support CUDA.

Moster gravatar imageMoster ( 2013-10-08 16:41:43 -0500 )edit

In fact Qualcomm S800 SoC has already support OpenCL, but OpenCL optimizations in OpenCV mostly do not work on it. They are mostly targeted on desktop GPU and use more compute units than mobile device has and some OpenCL extensions like double type, that are not available on this device.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-10-09 06:51:53 -0500 )edit

Question Tools


Asked: 2013-10-07 14:08:16 -0500

Seen: 3,964 times

Last updated: Oct 08 '13