Open Source Computer Vision Library
Go to file
Andrey Pavlenko 8e088d38a5 draft implementation of alternative CameraBridge via GLES
a simple sample will look like:

```java
public class MainActivity extends Activity implements CameraGLSurfaceView.CameraTextureListener {

	CameraGLSurfaceView mView;
	ByteBuffer buf;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        mView = new CameraGLSurfaceView(this, null);
        mView.setCameraTextureListener(this);
        setContentView(mView);
        buf = ByteBuffer.allocateDirect(1920*1080*4);
    }

    @Override
    protected void onPause() {
        mView.onPause();
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mView.onResume();
    }

	@Override
	public void onCameraViewStarted(int width, int height) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onCameraViewStopped() {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean onCameraFrame(int texIn, int texOut, int width, int height) {
		Log.i("MAIN", "onCameraFrame");
		int w=width, h=height;
		/*
		// option 1:
		// just return 'false' to display texIn on screen
		retutn false;
		*/

		/*
		// option 2:
		// fast copy texIn to texOut
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    	GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texOut);
		GLES20.glCopyTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 0, 0, w, h, 0);
		return true;
		*/

		// option 3:
		// read, modify and write back pixels
		GLES20.glReadPixels(0, 0, w, h, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf);

		buf.rewind();
		// red line
		for(int i=0; i<h; i++) {
			buf.position(w*4*i+i*4);
			buf.put((byte) -1);
			buf.position(w*4*i+i*4+4);
			buf.put((byte) -1);
		}
		buf.rewind();

		GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    	GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texOut);
		GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, w, h, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf);
		return true;
	}
}
```
2015-09-19 16:18:02 +03:00
3rdparty proposed change by psyill 2015-09-12 12:19:44 +02:00
apps add checks for valid input data given to parameters 2015-08-06 10:24:33 +02:00
cmake Merge pull request #5272 from avershov:opencl-vaapi-fallback 2015-09-14 11:54:20 +00:00
data move data/detect_blob.png in samples/data 2015-06-22 17:51:01 +02:00
doc Correction of minor typo. 2015-09-14 00:12:06 +08:00
include Added cmake option for abi descriptor generating (GENERATE_ABI_DESCRIPTOR) 2015-03-17 16:04:04 +03:00
modules draft implementation of alternative CameraBridge via GLES 2015-09-19 16:18:02 +03:00
platforms fixup! Some changes to support mingw-w64 2015-09-01 12:14:40 +03:00
samples Merge pull request #5272 from avershov:opencl-vaapi-fallback 2015-09-14 11:54:20 +00:00
.gitattributes Made changes to OpenCVFindMatlab suggested by SpecLad 2013-09-14 13:32:15 +10:00
.gitignore Added support for 'imgcodecs' module: 2015-03-31 16:31:37 +03:00
.tgitconfig Add tgit.icon project config 2014-02-26 17:46:52 +08:00
CMakeLists.txt Merge pull request #5272 from avershov:opencl-vaapi-fallback 2015-09-14 11:54:20 +00:00
LICENSE 1. Input/OutputArray optimizations; 2015-04-07 16:44:26 +03:00
README.md Update README.md 2015-08-06 14:00:24 +02:00

OpenCV: Open Source Computer Vision Library

Gittip

Resources

Contributing

Please read before starting work on a pull request: https://github.com/Itseez/opencv/wiki/How_to_contribute

Summary of guidelines:

  • One pull request per issue;
  • Choose the right base branch;
  • Include tests and documentation;
  • Clean up "oops" commits before submitting;
  • Follow the coding style guide.