Log in or register to post comments

What causes CameraDevice::getInstance().start() to return false?

November 26, 2019 - 11:04pm #4

Hi! everyone.

Looking for advice, especially from someone, who knows the internals of Vuforia library. Have been wrestling with the port from Vufora 6 to Vuforia 8.5 on iOS for a while now.

Long story short, for some unknown reason Vuforia::CameraDevice::getInstance().start() always return false. It is definitely not XCode, phone etc issue, because Vuforia samples work just fine. 

So, what I do:

separate thread:

Vuforia::setInitParameters(), Vuforia::GL_20 -> OK

Vuforia::init() -> OK, runs from 1 to 100 just fine

switch back to main thread:





Vuforia::TrackerManager::getInstance(); -> returns instance just fine

Vuforia::Tracker* trackerBase = trackerManager.initTracker(Vuforia::ObjectTracker::getClassType()) 

Vuforia::Tracker* deviceTracker = trackerManager.initTracker(Vuforia::PositionalDeviceTracker::getClassType()); -> both return instances, all OK

separate thread:

static_cast<Vuforia::ObjectTracker*>(trackerManager.getTracker(Vuforia::ObjectTracker::getClassType())) -> returns and casts OK

objectTracker->createDataSet() -> creates instance, OK

dataSet->load() -> loads without errors, OK

objectTracker->activateDataSet() -> returns true, all OK

Vuforia::CameraDevice::getInstance().init() -> OK

Vuforia::CameraDevice::getInstance().selectVideoMode(Vuforia::CameraDevice::MODE_DEFAULT) -> OK

Vuforia::Renderer::getInstance().setVideoBackgroundConfig() -> 1370,2436 (same as in samples), OK

Vuforia::Renderer::getInstance().getRecommendedFps() -> 60, same as in samples, OK

Vuforia::Renderer::getInstance().setTargetFps() -> OK

Vuforia::CameraDevice::getInstance().start() -> FAIL, returns false.


Additional info that I can think of:

1. Access to camera is granted: [34353:5575522] User pre-granted access to the camera

2. I also have the EAGL view set up properly (renderFrameVuforia is called periodically, so, library finds it).


Been digging and comparing samples' code and my code and running out of ideas.

If I could get a list of conditions, especially from someone, who knows the internals of the library, where CameraDevice start() method returns false, would help the further debugging.

Thanks in advance




What causes CameraDevice::getInstance().start() to return false?

December 3, 2019 - 2:17am #3


Looking at the steps you provided, overall it looks you are on the right path. You init, selectVideoMode() etc.

One thing based on the documentation that might be necessary is also to setField(). https://library.vuforia.com/content/vuforia-library/en/reference/cpp/classVuforia_1_1CameraDevice.html#ad64c54ab3191981b2443c47007f38516

Could you please give it a try?

If this doesn't work, could you please also provide the error you are getting?

Thank you.

Vuforia Engine Support

What causes CameraDevice::getInstance().start() to return false?

December 3, 2019 - 10:12am #2


Thank you for the reply.

Can you elaborate a bit more on the setField() option. I suspected that I might need to try set some camera fields, but read the documentation one way and another one, but could not find any definitions nor suggestions, what camera fields to set and to what. 

Two more things, where my code differs from the samples:

1) My code sits in the library that is compiled to static library (.a) and then linked to main app. Vuforia.Framework is included in main app and set to 'Sign and embed'.

Linking library and with library seems to be OK, no errors and other calls and callbacks, except start(), work fine.

2) I use external rendering engine (SceneKit), but this should not affect Vufora in any way, I still should get the Pose,  what i do with it, is my problem. Also drawing video background, haven't implemented the drawing part. But it shouldn't affect starting the camera, right?

What comes to error messages, there is none, that's why I am so desperate, have no idea, what to try next. Function just returns false and nothing is in application logs:

019-12-03 20:03:10.599624+0200 Museums[35991:6141552] initAR

2019-12-03 20:03:10.600008+0200 Museums[35991:6142085] initVuforiaInBackground

2019-12-03 20:03:10.602158+0200 Museums[35991:6141552] HintAudio ViewWillDissappear

2019-12-03 20:03:10.603397+0200 Museums[35991:6141552] SceneViewController did dissappear

2019-12-03 20:03:12.117073+0200 Museums[35991:6142085] User pre-granted access to the camera

2019-12-03 20:03:12.117636+0200 Museums[35991:6142085] INFO/AR(35991) 2019-12-03 20:03:12: Vuforia selected rendering API OpenGL ES 2.x

2019-12-03 20:03:12.117853+0200 Museums[35991:6142085] INFO/AR(35991) 2019-12-03 20:03:12: Vuforia SDK version 8.5.8

2019-12-03 20:03:12.117967+0200 Museums[35991:6142085] INFO/AR(35991) 2019-12-03 20:03:12: Vuforia SDK build 4334

2019-12-03 20:03:12.218625+0200 Museums[35991:6142085] INFO/AR(35991) 2019-12-03 20:03:12: Matched precache profile for Apple, iPhone10,6, iOS 13, 800.1

2019-12-03 20:03:13.222698+0200 Museums[35991:6142085] INFO/AR(35991) 2019-12-03 20:03:13: Vuforia Fusion: Detected and enabled use of ARKit

2019-12-03 20:03:13.223788+0200 Museums[35991:6142085] Rendering mode set to: OpenGL ES 2.0

2019-12-03 20:03:13.282431+0200 Museums[35991:6142085] Rendering mode set to: OpenGL ES 2.0

2019-12-03 20:03:13.282803+0200 Museums[35991:6141552] prepareAR

2019-12-03 20:03:13.283349+0200 Museums[35991:6141552] DEBUG/AR(35991) UIView has CAEAGLLayer layer class

2019-12-03 20:03:13.283399+0200 Museums[35991:6141552] DEBUG/AR(35991) UIView responds to selector renderFrameVuforia

2019-12-03 20:03:13.283627+0200 Museums[35991:6141552] initTracker

2019-12-03 20:03:13.321690+0200 Museums[35991:6141552] Successfully initialized trackers.

2019-12-03 20:03:13.321942+0200 Museums[35991:6142137] loadTrackerDataInBackground

2019-12-03 20:03:13.322199+0200 Museums[35991:6142137] loadObjectTrackerDataSet (/var/mobile/Containers/Data/Application/696068CE-0318-488B-86DC-07FB9889CC1A/Library/Application Support/simulacrum/evm_numu_2/tuulik.xml)

2019-12-03 20:03:13.329054+0200 Museums[35991:6142137] INFO/AR(35991) 2019-12-03 20:03:13: ObjectTracker: Successfully created dataset

2019-12-03 20:03:13.392451+0200 Museums[35991:6142137] Successfully activated data set.

2019-12-03 20:03:13.392644+0200 Museums[35991:6142137] startAR

2019-12-03 20:03:13.392945+0200 Museums[35991:6142137] startCameraWithWidth

2019-12-03 20:03:13.404199+0200 Museums[35991:6142137] configureVideoBackgroundWithCameraMode

2019-12-03 20:03:13.404280+0200 Museums[35991:6142137] VideoBackgroundConfig: size: 1370,2436

2019-12-03 20:03:13.404362+0200 Museums[35991:6142137] VideoMode:w=1920 h=1080

2019-12-03 20:03:13.404538+0200 Museums[35991:6142137] width=1125.000 height=2436.000

2019-12-03 20:03:13.405434+0200 Museums[35991:6142137] startAR failed with error


Thank you in advance and I hope we can sort it out... really stuck here and need solution quite fast.

What causes CameraDevice::getInstance().start() to return false?

December 4, 2019 - 4:38am #1

Aaand answering my question myself.

One of the situations, where everything else works just fine, but CameraDevice::getInstance().start() fails is when you do not have ARKit.framework included with the project. Took me 1 week to figure that one out :)



Log in or register to post comments