Log in or register to post comments

Camera access image wrong on the second run

December 10, 2013 - 9:33pm #1

I created a sample to access to background image as the document from here https://developer.vuforia.com/resources/dev-guide/unity-camera-image-access.

It runs well on the first time. I am able to take the background image in the first time running.

However, when I close the AR application (presh Home button on iPhone/iPad), then I open the AR application again. The background image taken on this time is not the real background image in the AR camera.

Does anyone know the reason? And how to get the correct background image in the second run?

Thank you.

Camera access image wrong on the second run

December 27, 2013 - 12:17pm #6

Camera access image wrong on the second run

December 18, 2013 - 8:08pm #5

In Vuforia 2.6.7, I followed the comment from joshsavage and it worked. However, when I update to Vuforia 2.8.7, I could not find where is CameraDevice.cs file. Do you have any suggestion?

"I fixed the issue. Note this issue only occurs the second time the AR scene is created e.g. on changing scenes or returning to the app. 

1) In CameraDevice.cs I make sure the camera images are cleared when it is deinitialized by adding "mCameraImages.Clear();" to the start of the Deinit() function.

2) In QCARBehaviour.cs I force the CameraDevice into RGB888 format after the camera is started. It's a bit of a hack but found that sometimes when the frame format is set in my start method it doesn't work. (perhaps the camera hasn't initialized at that stage, I haven't had time to investigate further)

// Start the camera and trackers and update the camera projection

private void StartQCAR(){

        CameraDevice.Instance.Init();

        ConfigureVideoBackground();

        CameraDevice.Instance.SelectVideoMode(CameraDeviceModeSetting);

        CameraDevice.Instance.Start()

        CameraDevice.Instance.SetFrameFormat(Image.PIXEL_FORMAT.RGB888,true);"

Camera access image wrong on the second run

December 12, 2013 - 3:22am #4

Nice.

Camera access image wrong on the second run

December 11, 2013 - 5:22pm #3

Thank AlessandroB,

I follow the post you gave and it works for me.

Thank you.

Camera access image wrong on the second run

December 11, 2013 - 12:08am #2
Log in or register to post comments