- Sort Posts
- 25 replies
- Last post
Take Screenshot
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.
From stackoverflow , i saw number of posts where i found glReadPixels is issue.
Some of the solutions there were using GL_BGRA mode but it's not available.
Regards
Vineet Aggarwal
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.
A question: do you have evidence that the bottleneck is just in the glReadPixels, or is it also the SavePNG function partially responsible of the slow performance ?
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.
Try to found on android forums but not get any answer. Can you please help.
Regards
Vineet Aggarwal
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;
this is a common Android error, you may want to search in some Android specific forums, for instance here is a thread about this topic:
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
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.
Please help me to resolve issue on samsung galaxy S2.
Take Screenshot
Take Screenshot
Take Screenshot
Hi, if you are rendering with OpenGL ES 2.0 (and not 1.1), you should replace this line:
gl.glReadPixels(x,
0
, w, y + h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, ib);
GLES20.glReadPixels(x,
0
, w, y + h, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);
That could be one problem.
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
public void onDrawFrame(GL10 gl) { if (!mIsActive) return; for (int i = 0; i < VideoPlayback.VIDEO_TARGETS; i++) { if (mVideoPlayerHelper[i] != null) { if (mVideoPlayerHelper[i].isPlayableOnTexture()) { if (mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.PLAYING) mVideoPlayerHelper[i].updateVideoData(); mVideoPlayerHelper[i].getSurfaceTextureTransformMatrix(mTexCoordTransformationMatrix[i]); setVideoDimensions(i, mVideoPlayerHelper[i].getVideoWidth(), mVideoPlayerHelper[i].getVideoHeight(), mTexCoordTransformationMatrix[i]); } setStatus(i, mVideoPlayerHelper[i].getStatus().getNumericType()); } } // Call our native function to render content renderFrame(); if (VideoPlayback.CAMERA_CLICK) SavePNG(0, 0, 400, 400, "test.png", gl); for (int i = 0; i < VideoPlayback.VIDEO_TARGETS; i++) { if (isTracking(i)) { if (mVideoPlayerHelper[i] != null) mVideoPlayerHelper[i].play(false, -1); } else { if (mVideoPlayerHelper[i] != null) mVideoPlayerHelper[i].pause(); } } } public void SavePNG(int x, int y, int w, int h, String name, GL10 gl) { Bitmap bmp = SavePixels(x, y, w, h, gl); try { File file = new File(Environment.getExternalStorageDirectory() + "/", name); try { file.createNewFile(); } catch (IOException e1) { e1.printStackTrace(); } FileOutputStream fos = new FileOutputStream(file); bmp.compress(CompressFormat.PNG, 100, fos); try { fos.flush(); } catch (IOException e) { e.printStackTrace(); } try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } } public Bitmap SavePixels(int x, int y, int w, int h, GL10 gl) { int b[] = new int[w * (y + h)]; int bt[] = new int[w * h]; IntBuffer ib = IntBuffer.wrap(b); ib.position(0); gl.glReadPixels(x, 0, w, y + h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, ib); for (int i = 0, k = 0; i < h; i++, k++) { for (int j = 0; j < w; j++) { int pix = b[i * w + j]; int pb = (pix >> 16) & 0xff; int pr = (pix << 16) & 0x00ff0000; int pix1 = (pix & 0xff00ff00) | pr | pb; bt[(h - k - 1) * w + j] = pix1; } } Bitmap sb = Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888); return sb; }
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
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
Regards
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),
the tutorial explains how to use the QCAR API to get the camera frame, the rest is beyond the scope of Vuforia and this forum.
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.
2. If Image is displaying on top of ImageTarget , then Capture Image with background and save in sdcard
3. If Video is displaying on top of target, then Capture VideoFrame with background and save in sdcard.
I don't see any native method in the link you provided which i can call on button click to capture image.
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.
HI,
I tried your code to take screen shot ( in android) , i could get a camera view with no overly image in it. how do i get a screenshot along with the overly image on top of the camera ?