Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The only real chance is to use openGL ES and fragment shader (it will require at least openGL ES 2.0) and do the chroma key effect on GPU. The shader itself will be quite easy (google).</p> <p>But to do that, you need to display camera preview with callback. You will have to implement <a href="http://developer.android.com/reference/android/hardware/Camera.PreviewCallback.html" rel="nofollow noreferrer"><code>Camera.PreviewCallback</code></a>, create a buffer for image data and use <code>setPreviewCallbackWithBuffer</code> method. You can get the basic idea from my <a href="https://stackoverflow.com/a/8372731/683905">answer</a> to a similar question. Note that there is a significant problem with performance of this custom camera preview, but it might work on hardware that supports ES 2.0.</p> <p>To display the preview with openGL, you will need to extend <a href="http://developer.android.com/reference/android/opengl/GLSurfaceView.html" rel="nofollow noreferrer"><code>GLSurfaceView</code></a> and also implement <code>GLSurfaceView.Renderer</code>. Then you will bind the camera preview frame as a texture with <code>glTexImage2D</code> to some simple rectangle and the rest will be handled by shaders. See how to use shaders in ES <a href="https://stackoverflow.com/questions/4850025/shader-for-android-opengl-es">here</a> or if you have no experience with shaders, <a href="http://blog.shayanjaved.com/2011/03/13/shaders-android/" rel="nofollow noreferrer">this tutorial</a> might be a good start.</p> <p>To the other question: you could save the current image from the preview, but the preview has lower resolution than a taken picture, so you will probably want to take a picture and then process it separately (you could use the same shader for it).</p> <p>As for the C++, it's a lot of additional effort with questionable output. But it can improve performance if done right. Try to check this <a href="http://nhenze.net/?p=253" rel="nofollow noreferrer">article,</a> it's on a similar topic, it describes how to use NDK to process camera preview and display it in openGL. But if you were thinking about doing the chroma key effect in C++, it would be significantly slower than shaders.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload