Software Archive
Read-only legacy content
17061 Discussions

Gaze Tracking with F200 in C++

Joshua_N_
Beginner
231 Views

 

I'm trying to integrate the Gaze Tracking module into an existing application and am having some problems that are puzzling me. Anything I do to initialize the gaze tracking and then read from the F200 eventually throws an error "Exception thrown at 0x09026AAB (libpxcface_idc.dll) in rsEyeTrack_debug.exe: 0xC0000005: Access violation reading location 0x00000004.". I've read through the example application but seem to missing a crucial aspect of it somewhere. I've stripped my application down to the following:

 

void RSDevice::threadedFunction()
{

		while (isThreadRunning())
		{

			lock();

			if (doInit == true)
			{

				mSenseMgr = PXCSenseManager::CreateInstance();
				if (mSenseMgr != NULL)
				{
					cout << "  OK so far " << endl;
				}

				mSenseMgr->EnableFace();

				if (mSenseMgr->Init() < PXC_STATUS_NO_ERROR) {
					cout << " can't init mSenseMgr " << endl;
				}

				mSenseMgr->QueryCaptureManager()->SetRealtime(true);

				mFaceTracker = mSenseMgr->QueryFace();
				if (mFaceTracker == NULL)
				{
					assert(mFaceTracker);
				}
				PXCFaceConfiguration* fconfig = mFaceTracker->CreateActiveConfiguration();
				if (fconfig == NULL)
				{
					assert(fconfig);
				}

				PXCFaceConfiguration::TrackingModeType trackingMode = fconfig->GetTrackingMode();
				
				if (trackingMode == PXCFaceConfiguration::FACE_MODE_COLOR_PLUS_DEPTH)
				{
					PXCCapture::Device::StreamProfileSet profiles = {};
					mSenseMgr->QueryCaptureManager()->QueryDevice()->QueryStreamProfileSet(&profiles);
				}

				mNeedGazeCalibration = true;

				if (mSenseMgr)
				{
					if (mSenseMgr->EnableFace() >= PXC_STATUS_NO_ERROR)
					{
						mFaceTracker = mSenseMgr->QueryFace();
						if (mFaceTracker)
						{
							fconfig = mFaceTracker->CreateActiveConfiguration();

							fconfig->SetTrackingMode(PXCFaceConfiguration::TrackingModeType::FACE_MODE_COLOR_PLUS_DEPTH);

							fconfig->detection.isEnabled = true;
							fconfig->landmarks.isEnabled = true;
							fconfig->pose.isEnabled = true;

							fconfig->EnableAllAlerts();
							//config->SubscribeAlert(&alertHandler);

							fconfig->ApplyChanges();

							fconfig->QueryGaze()->isEnabled = true;

							int dominantEye = 0;
							PXCFaceData::GazeCalibData::DominantEye eye = (PXCFaceData::GazeCalibData::DominantEye)(dominantEye - 1);
							fconfig->QueryGaze()->SetDominantEye(eye);

							fconfig->ApplyChanges();
							fconfig->Release();

							mFaceData = mFaceTracker->CreateOutput();

							mShouldGetGaze = true;

							cout << " have gaze, things are not too bad " << endl;
						}
						else
						{
							cout << " no gaze, things are bad  " << endl;
							mShouldGetGaze = false;
						}
					}
					else
					{
						cout << " no mSenseMgr->EnableFace(), things are bad " << endl;
					}
				}
				doInit = false;
			}
			else
			{
                              // just doing this to see if we can read the camera, but it crashes
                                pxcStatus cStatus = mSenseMgr->AcquireFrame(true);

				if (cStatus < PXC_STATUS_NO_ERROR) {
					cout << "  mSenseMgr->AcquireFrame() error " << endl;
				}

				mSenseMgr->ReleaseFrame();
			}
			unlock();
			sleep(30);
		}
	}

 

I've pared it down so that nothing else is happening, no drawing, no other device access, just this single method which is essentially taken from the FF_EyeTracking_2015 example application. Is there something egregious in here? I can't initialize gaze tracking without tanking the application, not sure what I've missed.

0 Kudos
0 Replies
Reply