1

I am new to google-project-tango, and I want to record the images from Tango's color camera image buffer rather than fisheye camera. I saw henderso's sharing -- reading of the GL buffer to save the image, and modified his code to record the images-- keep saving every image when we get any onFrameAvailable() callback. I also try to lock the buffer or use semaphore, when i got the onframeavailable callback. But the results look like this one--is it the synchronization problem of GL buffer?.

The MainActivity implements TangoCameraScreengrabCallback:

        public void onFrameAvailable(int arg0) {                
            if (mIsRecording){
                tangoCameraPreview.takeSnapShot();
                try {
                    mutex_on_mIsRecording.acquire();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                tangoCameraPreview.onFrameAvailable();
                mutex_on_mIsRecording.release();

            }
        }

And tangoCameraPreview.onFrameAvailable() will do as follows:

    public void onFrameAvailable() {
        super.onFrameAvailable();
        if(recording) {
            synchronized (intBuffer){
                screenGrabRenderer.grabNextScreen(SCREEN_GRAB_X, SCREEN_GRAB_Y, SCREEN_GRAB_W, SCREEN_GRAB_H, intBuffer);
            }
        }
    }
Community
  • 1
  • 1
eva9527
  • 11
  • 1
  • one guess I have is that you are taking snap shot from onFrameAvailable instead of render thread, thus the render is still keep going, what would happen if you signal the render thread and take the screenshot there. Also, what's the difference between the takeSnapShot() and screenGrabRenderer function? – xuguo Jul 30 '16 at 00:30

0 Answers0