Log in or register to post comments

Release camera to use FRONT camera

August 30, 2012 - 2:37am #1

Situation I have running aplication with AR layer using vuforia.

At some point i need to stop the back camera, which is used for marker tracking, an start preview from front camera. in android there can be open just one camera at same time. Is there a way to tell QCAR to stop the backing camera and release it, so i will be able to use front camera?

 

I tried to get information about camera in onCreate 

public void onCreate(Bundle savedInstanceState) {

Camera c=Camera.open(0);//open the back camera
/*
get parameters etc
*/
c.release();
c=null; 

super.onCreate(savedInstance);

/*
another code for initialization of activity
*/ 

}

in application which is not using QCAR this is working, but with QCAR the application crashes. So i think QCAR takes the camera exclusively so i cannot use it. Am I right?

Release camera to use FRONT camera

August 30, 2012 - 1:01pm #2

Yes it does. Take a look at the ImageTargets sample and the use of the CameraDevice singleton. You can use this to start and stop the device camera, which should enable you to switch to the front camera.

e.g.

    QCAR::CameraDevice::getInstance().stop();
    QCAR::CameraDevice::getInstance().deinit();

Log in or register to post comments