By vinny82
on Fri, 03/29/2013 - 21:03
Hi ,
Please suggest should we use Android Camera API to take sceenshots or there is native api available in Vuforia for this functionality.
I am looking to create a button and take picture on click.
Regards
Vineet Aggarwal
Take Screenshot
Hi, you can use the Vuforia API to get the camera frame image, as explained here in detail and with code snippets to do that:
https://developer.vuforia.com/forum/faq/android-how-can-i-access-camera-image
That tutorial should guide you to achieve exactly what you are aiming for.
Take Screenshot
Hi,
Thanks for reply
I go through the tutorial but it seems i would not achieve my objective. My Objective is to on clicking button , user should able to
1. Capture Screenshot normally ( Like we normally does) and save in sdcard.
Take Screenshot
Hi, how to trigger the capture via a button click, and how to save it on sdcard is not a problem specific to Vuforia and the QCAR API, but it is application specific (and Android related),
Take Screenshot
Hi
I understand and therefore not seeking any help on application specific code.
The problem is when i use android specific camera api it's capture the imagetarget but not the image augment on top of target.
Please help me how the capture the augmented image
Take Screenshot
Ok, if need to capture the AR view with the 3D objects (augmentation), then you need to use an OpenGL technique based on glReadPixels function;
the process is discussed in this thread:
https://developer.vuforia.com/forum/android/screen-capture-3d-object
Take Screenshot
Hi ,
Thanks for correct link . I use it but I am getting the saved png as black.
What wrong i m doing
Here is the code
Take Screenshot
Hi, if you are rendering with OpenGL ES 2.0 (and not 1.1), you should replace this line:
Take Screenshot
Thanks , I am now able to take image but now i am facing two new problems
1. The rending becomes too slow
2. I am only capture part of view.
What can be possible reason?
Regards
Vineet Aggarwal
Take Screenshot
Hi ,
The issu was at my end.
I was providing width 100 , height 100 , now i m providing device height and width and its ok.
slow rendering was happening as by mistake i was trying to capture each frame.
Take Screenshot
Thanks Moderators
You really helped me
Take Screenshot
You're welcome. Glad to see that you implemented and solved everything as intended.
Take Screenshot
Hi ,
I have tested my app and its working fine in Samsung Galaxy S3 and Galaxy Note \\
I am able to receive full image in both devices.
In samsung Galaxy S2 , I am getting 1/4 IMAGE . Rest of the screen is black.
Take Screenshot
hi, can you share the code where you determine the width and height (that you then pass to the glReadPixels)
Take Screenshot
SavePNG(0, 0, 720, 1280, "image00" + VideoPlayback.IMG_COUNT + ".png");
Currenly i am setting static values. i will set it to deveice screen size and width.
samsung galaxy s3 and samung galaxy s2 both have resolution 720x1280.
Take Screenshot
Ok; maybe try with using the actual width and height values, it might be that on the S2 the resolution is different when rendering (note: you can get the width and height values from the updateRendering function in ImageTargetsRenderer.java)
Take Screenshot
Another thing you may also want to try is to add this line in your ImageTargetsRenderer.java, right after the renderFrame() line (in onDrawFrame()):
GLES20.glFinish();
(i.e. right before you call your code to save the PNG).
Take Screenshot
The issue with Samsung galaxy S2 is resolved.
Thanks Moderators for fix.
But now I am getting issue in Nexus One.
Take Screenshot
Hi,
the error log shows that you are trying to drwa a recycled bitmap, which means that you probably have some code in which you dispose your bitmap;
Take Screenshot
Hi Alessandro ,
My code is to take screenshot is working fine. Thanks for your help.
I found glReadpixels slow .
After calling glreadpixels the screen pauses fro 1 second and then flickers.
Take Screenshot
Hi,
I am not aware of other easy ways to capture an OpenGL screenshot, other than using the glReadPixels; I know that this method can be a bit slow, especially on non-high-end devices.
Take Screenshot
Hi ,
Thanks for reply.
I am using high end device S3 . I am developing app only for ICS nad JellyBean platforms
In Save PNG function , after getting the bitmap image we are just writing to outputstream so it should not take time.