Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do real-time face tracking? #160

Open
storewaladotcom opened this issue Jul 12, 2017 · 11 comments
Open

How to do real-time face tracking? #160

storewaladotcom opened this issue Jul 12, 2017 · 11 comments

Comments

@storewaladotcom
Copy link

Is there a better way to generate a bmp other than the code below:

bufferTexID = Common.genBlankTextureID(mRecordWidth, mRecordHeight);
                    frameBufferObject.bindTexture(bufferTexID);
                    GLES20.glViewport(0, 0, mRecordWidth, mRecordHeight);
                    mFrameRecorder.drawCache();
                    buffer = IntBuffer.allocate(mRecordWidth * mRecordHeight);
                    GLES20.glReadPixels(0, 0, mRecordWidth, mRecordHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buffer);
                    bmp = Bitmap.createBitmap(mRecordWidth, mRecordHeight, Bitmap.Config.ARGB_8888);
                    bmp.copyPixelsFromBuffer(buffer);
                    Log.i(LOG_TAG, String.format("w: %d, h: %d", mRecordWidth, mRecordHeight));

The code is causing a minor lag in the UI. My use case = While the video is recording, take a BMP periodically and check if there is a face in the BMP. If there is another cleaner way of doing this, please suggest.

@storewaladotcom
Copy link
Author

any pointers on how to incorporate CGEFaceTracker into CGEFrameRecorder? That may address my issue as well.

@wysaid
Copy link
Owner

wysaid commented Jul 12, 2017

You may need to do this in another thread.
Just use CGESharedGLContext to create another context( shared with the view)
And put your all code in the background thread.

@wysaid
Copy link
Owner

wysaid commented Jul 12, 2017

The CGEFaceTracker is not so correct when doing real-time processing.
I will add a new case for this issue later.

@storewaladotcom
Copy link
Author

thank you, I will look forward to that code.

@storewaladotcom
Copy link
Author

Could you provide some code on using the sharedcontext please?

@storewaladotcom
Copy link
Author

Thank you. I did see that piece of code. how can i get a Bitmap from the shared context?

@wysaid
Copy link
Owner

wysaid commented Jul 13, 2017

You should not use the Bitmap. It's extremely slow.
I will do this issue later.
And you should change the title to How to do real-time face tracking.

@storewaladotcom storewaladotcom changed the title generate bmp? How to do real-time face tracking? Jul 13, 2017
@storewaladotcom
Copy link
Author

Thank you @wysaid . I will look forward to this when you get a chance to implement. I went ahead and changed the title.

@storewaladotcom
Copy link
Author

@wysaid could you point me to do face recognition at the c++ layer?

@wysaid
Copy link
Owner

wysaid commented Jul 25, 2017

You may take look at the pr
I'm very busy recently, and I will do that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants