Frage

This is my first question. I need to help for live camera on android. I want to create camera preview(on surface view). android application for android with some function:

  • Flip mirror camera in live preview camera. (It's same rotateX or rotateY).

I was try flip bitmap on Camera.PreviewCallback then redraw Surface but it very slow. Then I try using open cv. But it to larger for my application.

[Android api >= 10.]

Give me some idea to fix my prob. Thanks so much. // Sorry for my english.

War es hilfreich?

Lösung

If you cannot use SurfaceTexture, consider hiding the preview surface (you still need a live SurfaceView to launch Camera.startPreview()). Use Camera.PreviewCallback(), push the YUV frames to an OpenGl texture via a shader, and render them in OpenGL. See Android OpenGL ES process yuv preview as RGBA as a starting example.

I strongly suggest to build separate code for API >= 11 with SurfaceTexture, because the system is getting much more strict in enforcing visible live preview with every upgrade. It is still possible to hide the SurfaceView, but for API <= 10 you could simply move it to (10000, 10000) and not use more sophisticated and less robust workarounds.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top