Capturing Android screen buffer and transferring it to OpenCV.
This application will create a screen shoot from the Android screen buffer using OpenCV.
There are better ways to do it, but now you can process the screen image using OpenCV.
You will need the Android SDK, Android NDK, OpenCV and root on the device.
I'm asuming that the Android screen buffer is in RGBA8888
format.
You can find out the screen buffer format using:
vscreeninfo.bits_per_pixel
vscreeninfo.red.offset
vscreeninfo.green.offset
vscreeninfo.blue.offset
vscreeninfo.transp.offset
vscreeninfo.red.length
vscreeninfo.green.length
vscreeninfo.blue.length
vscreeninfo.transp.length
README.md
jni/cv_screenshot.cpp
jni/Android.mk
jni/Application.mk
$ ndk-build
- Mount the
system
asrw
:
$ adb shell "mount -o remount,rw /system"
- Push:
$ adb push libs/armeabi-v7a/cv_screenshot /system/bin/cv_screenshot
$ adb shell
# cd /sdcard
# cv_screenshot
# exit
$ adb pull /sdcard/screen.png
Hi, I was trying to test this code for android but the screenshot is a black image.