Log in or register to post comments

ARCamera returns black screen when calling readpixels

August 10, 2012 - 12:19am #1

I have tried to use Texture2D.ReadPixels to get a screenshot as I want to save the camera view with the 3D models appeared. It works well on samsung SI, SIII and those HTC phone I can find, but it always return black screen on samsung not and SII.

If I called camera.render() just before I readpixels, it can get the 3d models but still not the cam view. 

Can anyone help? Thank you very much in advance. 

ARCamera returns black screen when calling readpixels

November 8, 2012 - 8:51am #9

I see - I think that you'll have to remove the UI elements when you take the screen shot. Because it's going to grab everything that's rendered on screen. Can you toggle these off and on when executing the screen shot?

ARCamera returns black screen when calling readpixels

November 7, 2012 - 11:43pm #8

Hello again David,

I apologize for not being able to convey myself eloquently. Let me try it again:

 

I've a scene which has some user interface buttons on the top and the bottom. In the same scene, I've a 3d model of an object on the screen with the camera view on the background. That is, I've a 3d model which is always visible(active) on the screen regardless of a trackable. What I want to do is to take a screenshot of this screen without the user interface buttons, but including the 3d model. I'll post images from a sample application so that you can have a better idea. These are screenshots from the VW Up3d application by Volkvagen. 

Screenshot hardware(taken  by long pressing S-Pen on screen):

https://www.dropbox.com/s/s380908m2onmyou/Screenshot_hardware.png

Screenshot software. Taken by UI button in application.

https://www.dropbox.com/s/laodwl34ouasrw1/Screenshot_software.png

 

As you can see, in the second image, the user interface buttons are not visible. I want this kind of functionality in my application.

 

Many thanks,

Parth

ARCamera returns black screen when calling readpixels

November 7, 2012 - 5:59pm #7

No it won't, that will only give you the camera image. The approach that you're using is appropriate for screen shots - see: https://ar.qualcomm.at/content/unity-how-can-i-capture-screen-shot

But what do you mean when you state that .. I want the screenshot without the GUI then?

Also what are you seeing when you test the approach that you're using on the Note?

ARCamera returns black screen when calling readpixels

November 7, 2012 - 4:57am #6

Hello David,

I've gone through that post before. But I understand that Image.Pixels gives the bytes as raw pixels and when I try to write them to a png file using WriteAllBytes(), the image is invalid.

Also, I'd like to explain my scene better. Actually I've a 3d model which is on the camera view no matter if there's a trackable or not. And I want this 3d model to be present in the screenshot. I'm not sure whether the method you suggest takes care of this. If it does, can you tell me how to save this bytes data we get from Image.Pixels?

 

Many thanks,

Parth 

ARCamera returns black screen when calling readpixels

November 5, 2012 - 2:30pm #5

ARCamera returns black screen when calling readpixels

November 5, 2012 - 11:28am #4

Thank you for the quick reply.

Actually, the screen is black. ReadPixels and CaptureScreenshot work perfectly fine, but I want the screenshot without the GUI. Hence, I want to work with this approach. I know that RenderTexture renders the screen without any GUI, but using that approach, the 3d objects appear in the screenshot but not the camera view.

http://stackoverflow.com/questions/11899192/use-texture2d-readpixels-with-qualcomm-arcameravuforia

According to this post, it doesn't work with the galaxy Note and the galaxy S2. Unfortunately, I only have the note2 to work on and can't test on other devices.

I've also seen the post where someone suggested turning off the GUI using some flag (e.g. !captureScreenshot) and taking screenshot and then turning it on again. If nothing works out, I'll go to this option. But, I'm sure something can be done otherwise.

Any suggestions about how to get the screenshot without the GUI?

 

Edit:

https://ar.qualcomm.at/content/camera-get-image-camera#comment-2013961

Link to the post about the GUI flag.

ARCamera returns black screen when calling readpixels

November 5, 2012 - 11:06am #3

If the screen shot is black, or partially rendered, it's usually because the image is being grabbed before the frame is fully rendered. Though I'm not sure why this is occuring on only a few devices. See: https://ar.qualcomm.at/content/unity-how-can-i-capture-screen-shot

ARCamera returns black screen when calling readpixels

November 5, 2012 - 10:25am #2

Hey,

I'm stuck at a similar problem. Did you find a solution to this? I've tried almost everything - ReadPixels, RenderTexture, getcameraimage, but nothing seems to work. I'll be grateful if you could point me in the right direction.

Log in or register to post comments