Log in or register to post comments

How to use front-facing camera under Vuforia SDK 2.0.31

March 1, 2013 - 3:51pm #1

Hi, a bit of a newbie to Vuforia.  I have just downloaded and installed the Vuforia SDK 2.0.31 with Eclipse under Win7.  I am able to run the sample "ImageTargets", but am unable to change to the front-facing camera.  I am testing on an Asus Transformer TF300T btw.  I have tried changing to "QCAR::CameraDevice::CAMERA camera = QCAR::CameraDevice::CAMERA_FRONT;" under ImageTargets.cpp but to no avail.

 

I was just wondering whether I was missing something: whether I need to amend another piece of code, add some code to the java class, or maybe it's a known problem with Asus TF300T tablets or TEgra 3 chips?

 

Any help would be very much appreciated.

How to use front-facing camera under Vuforia SDK 2.0.31

March 4, 2013 - 6:56am #8

Ok, thanks, I will bring it up to our team for investigation. I'll keep you updated.

How to use front-facing camera under Vuforia SDK 2.0.31

March 4, 2013 - 6:19am #7

Hi Alessandro, here are the device details:

 

  • Model Number: ASUS Transformer Pad TF300T
  • Android Version: 4.1.1
  • Camera Version: TF300T-000128

 

Hope this helps.  Let me know if you need any further details.

How to use front-facing camera under Vuforia SDK 2.0.31

March 4, 2013 - 2:21am #6

Hi, running ndk-build from cygwin is just the perfect procedure, so no problem with that; 

however (although I believe you already did that), after ndk-build has successfully completed the build, always make sure to refresh the project in Eclipse, so that Eclipse will pick up the latest binaries produced by ndk-build (otherwise it might still use an old build);

then you can safely run (after the refresh).

if you are sure that you did that step too, then it is most likely a device issue; in that case, could you tell me the exact model number of your device and Android version please (you can find that information in your Settings) ?

 

 

How to use front-facing camera under Vuforia SDK 2.0.31

March 3, 2013 - 11:36am #5

Hi AlessandroB, tried again but no luck.  Managed to build and test with FrameMarkers sample but still accessing default back camera.  Guess it must be a device issue.

 

Just one more thing I thought I should check.  I'm running Win7 so ran the ndk-build using cygwin. Is that right or should I be using something in Eclipse?

 

Thanks for all your help with this.

How to use front-facing camera under Vuforia SDK 2.0.31

March 3, 2013 - 6:32am #4

Hi, your camera initialization code is actually correct, i.e. this is the correct code to enable the front camera:

JNIEXPORT void JNICALL

 

Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_startCamera(JNIEnv *,
                                                                         jobject)
{
    LOG("Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_startCamera");
    
    // Select the camera to open, set this to QCAR::CameraDevice::CAMERA_FRONT 
    // to activate the front camera instead.
    QCAR::CameraDevice::CAMERA camera = QCAR::CameraDevice::CAMERA_FRONT;
 
    // Initialize the camera:
    if (!QCAR::CameraDevice::getInstance().init(camera))
        return;
 
Maybe try once more (make sure to run ndk-build and to refresh the Eclipse project before running); if still not working, it could an issue with the device..
 
 

How to use front-facing camera under Vuforia SDK 2.0.31

March 2, 2013 - 10:08am #3

Hi AlessandroB, thanks for getting back to me so quickly.

 

Looks like from the sample code, the camera is initialised on the next line:

QCAR::CameraDevice::CAMERA camera = QCAR::CameraDevice::CAMERA_FRONT;

    // Initialize the camera:
    if (!QCAR::CameraDevice::getInstance().init(camera))
        return;

Tried exchanging with QCAR::CameraDevice::init ( QCAR::CameraDevice::CAMERA_FRONT ); but with no luck.

 

Unfortunately cannot test with the other samples as they all crash at runtime.  Will see if I can fix one, otherwise possibly a problem with my tablet?  Again, any suggestions you could give me would be greatly appreciated.

How to use front-facing camera under Vuforia SDK 2.0.31

March 2, 2013 - 1:17am #2

Hi, you also need to initialize the camera with the desired parameter:

in ImageTarget.cpp you should find a line of code like:

QCAR::CameraDevice::init ( )

you should adjust it to:

 

QCAR::CameraDevice::init ( QCAR::CameraDevice::CAMERA_FRONT );

This will tell Vuforia to initialize and use the front camera.

You can also have a look here:

https://developer.vuforia.com/resources/dev-guide/new-api-vuforia-v20

 

Log in or register to post comments