"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

How to capture AR view

i want to capture ar view in my app.

i have been read this thread:https://developer.vuforia.com/forum/faq/android-how-can-i-capture-ar-view

and i also do what AlessandroB say on this thread:

https://developer.vuforia.com/forum/qcar-api/how-make-screenshot

i try on my project, it didn't show anyerror. but i also didn't got my screenshot.

 

i didn't see any error in LogCat. i think i must show my code to you, so this my code on ImageTargetsRendered.java

 

public boolean mTakeScreenshot = false;
    public void takeScreenshot() {
      mTakeScreenshot = true;    
    }
    
    public void onDrawFrame(GL10 gl)
    {
        if (!mIsActive)
            return;
 
        // Update render view (projection matrix and viewport) if needed:
            //mActivity.updateRenderView();
 
        // Call our native function to render content
        renderFrame();
         
        // make sure the OpenGL rendering is finalized
        GLES20.glFinish();
        
        
        if (mTakeScreenshot==true) {
            saveScreenShot(0, 0, mViewWidth, mViewHeight, "test.png");
            mTakeScreenshot = false;
        }
    }

 

that the last part from your code and i add takeScreenshot method that i call in ImageTargets.java with this code:

public void takeScreenshot2(View view) {
        ImageTargetsRenderer ambil = new ImageTargetsRenderer();
        button1.setVisibility(View.INVISIBLE);
        ambil.takeScreenshot();
        button1.setVisibility(View.VISIBLE);
      }

 

there is any wrong code that i add??

masbejo40

Sun, 05/19/2013 - 09:48

did you mean this code "mRenderer = new ImageTargetsRenderer();" ?

owh yes, that the problem. i got my screenshot. thanks for your help.

Hi Guys,

I am looking to integrate this in the CloudReco example. For this I followed the post https://developer.vuforia.com/forum/faq/android-how-can-i-capture-ar-view.

I'm setting the flag to take screenshot on click of button in CloudReco.java.

I have some imageView being displayed on the camera_overlay_layout. The intent is to take a screenshot with this imageview and the video background.

I have these images being displayed on the screen when I press the capture button.

If you are trying to capture the overlay too, that will not work, because the technique that I illustrate to capture the AR view is only meant for capturing OpenGL-based content.

Thanks for your assistance.

I tried the following piece to save the screenshot of the content view (overlay). This works fine to save the overlay content albeit with a black background.

If you can capture the overlayView (with black background) and the underlying AR view in 2 separate bitmaps, 

then what you could try is to combine those bitmaps into one, by manipulating their pixels;