OpenCV 3 RC1 has been released. It has transparent api to run on CPU or GPU.
to make openCV transparent, it uses OpenCL kernels. To run OpenCV on GPU, the GPU should have openCL 1.2 support.
My questions are:
1- Since Mali T6xxx support OpenCL 1.1, is there any documentation on how to adjust OpenCV to work with it?
2- Is there any documentation on how to optimize openCV to work better on Mali GPUs?
3- Does OpenCV works properly on T7xxx which has OpenCL 1.2 support?
4- Is there any other image processing library out there which is optimized for Mail GPUs?
Hi mans,
We haven't tried this particular release but have successfully built OpenCV for Android from Itseez's "master" git branch a couple of weeks ago without requiring any modification.
It ran successfully on T604 based devices and even though we haven't checked I don't see any reason for it not to work on any other Midgard GPU.
To build the libraries and the native tests you just need to do:
ANDROID_NDK=<path_to_android_ndk> ./platforms/scripts/cmake_android_arm.sh cd platforms/build_android_arm/ cmake-gui .
ANDROID_NDK=<path_to_android_ndk> ./platforms/scripts/cmake_android_arm.sh
cd platforms/build_android_arm/
cmake-gui .
Tick NEON / OpenCL
Press "configure"
Press "generate"
Close cmake-gui
make -j8
The way OpenCV is designed means there are a lot of memory copies required before any job is dispatched to the GPU which is perfectly fine for prototyping but if you're interested in performance I would recommend extracting the features you need from the library and create your own application.
Then you can start optimizing for Mali the OpenCL kernels (I don't think it makes sense to do it before you create your own application as it will be hard to mask the overhead of copies, etc.), I don't think there is anything special about optimizing for computer vision algorithms, you will just have to follow the usual rules: vectorisation, avoid barriers and local memory if they're not needed, etc. ( ARM Mali-T600 Series GPU OpenCL Developer Guide )
I'm happy to give more feedback if you need advice on that.
Unfortunately at the moment nothing else is available for Mali GPUs
Thanks,
Do you have any sample code that I can run on odroid XU3 and see that openCV code actually runs on GPU?
If it is with openCV 3.0, it is much better, otherwise any other version is sufficient.
If you run any OCL test from the OpenCV unit tests it will run the same algorithm once on the CPU and once on the GPU
Assuming you already have uploaded the "testdata" folder from Itseez/opencv_extra · GitHub to your device, and that you built and installed the android binaries to a "bin" folder, all you need to do is:
for f in `ls bin | grep opencv_test_`; do echo "Running $f ... "; adb push bin/$f /data/ adb shell OPENCV_TEST_DATA_PATH=/sdcard/opencv_testdata /data/$f --gtest_filter=*OCL* adb shell rm /data/$f done
for f in `ls bin | grep opencv_test_`; do
echo "Running $f ... ";
adb push bin/$f /data/
adb shell OPENCV_TEST_DATA_PATH=/sdcard/opencv_testdata /data/$f --gtest_filter=*OCL*
adb shell rm /data/$f
done