Adding effect to an Android Camera preview

2019-04-01 17:01发布

问题:

I am looking to get Live camera feed and add effects to it and display it. Which is the right technology to go forward with. Any open source

回答1:

You can configure camera class to provide you the preview buffer (but copies). This is provided throuh PreviewBuffer Callback interface. You have implement the interface and set it on the camera. During preview you will get the preview buffers. http://developer.android.com/reference/android/hardware/Camera.PreviewCallback.html

Then you can apply custom processing algorithm on the buffer and use either Surface or opengl surface to draw the same.

Shash316



回答2:

Check out OpenCV... it will require you to do some work in C/C++, JNI and the Android NDK but it is a really nice library and should do what you need pretty easily.



回答3:

Kieran is right, OpenCV would be a good and easy way with a lot of capabilities. See http://opencv.willowgarage.com/wiki/AndroidTrunk for details of the android implementation.

And checkout the sample application: https://code.ros.org/svn/opencv/trunk/opencv/android/apps/OpenCV_SAMPLE/ This should get you a good starter as it is an example using processors for the live image.