Simple INPVector application
Posted: Thu Jun 05, 2008 3:23 am
Hi,
I'm trying to write a simple application with INPVector, but it fails with acces violation exception when I call Update method on the Vector. Please could you tell me what else is need to be set?
I tried to run code from this topic
http://forum.naturalpoint.com/forum/ubb ... mber=17794
and it fails on Update method too. But vector tracking in Optitrack SDK Sample Application works good.
Thanks for help, Mark
code:
CoInitialize(NULL);
CComPtr cameraCollection;
CComPtr camera;
CComPtr frame;
CComPtr vector;
cameraCollection.CoCreateInstance(CLSID_NPCameraCollection);
vector.CoCreateInstance(CLSID_NPVector);
cameraCollection->Enum();
long cameraCount = 0;
cameraCollection->get_Count(&cameraCount);
if(cameraCount==1)
{
cameraCollection->Item(0, &camera);
camera->Open();
camera->SetOption(NP_OPTION_VIDEO_TYPE,(CComVariant) 2 );
camera->SetOption(NP_OPTION_FRAME_DECIMATION,(CComVariant) 0 );
camera->SetOption(NP_OPTION_NUMERIC_DISPLAY_ON, (CComVariant)32);
camera->SetOption(NP_OPTION_FRAME_RATE,(CComVariant) 25);
camera->SetOption(NP_OPTION_THRESHOLD,(CComVariant) 150);
camera->SetOption(NP_OPTION_EXPOSURE,(CComVariant) 55);
camera->SetOption(NP_OPTION_INTENSITY,(CComVariant) 1);
camera->SetOption(NP_OPTION_MINIMUM_SEGMENT_LENGTH,(CComVariant) 75);
camera->SetOption(NP_OPTION_MAXIMUM_SEGMENT_LENGTH,(CComVariant) 200);
camera->Start();
camera->GetFrame(0, &frame);
vector->Reset();
vector->Update(camera,frame); // HERE IT FAILS
.
.
.
camera->Stop();
camera->Close();
camera.Release();
vector.Release();
}
cameraCollection.Release();
CoUninitialize();
ExitProcess(1);
I'm trying to write a simple application with INPVector, but it fails with acces violation exception when I call Update method on the Vector. Please could you tell me what else is need to be set?
I tried to run code from this topic
http://forum.naturalpoint.com/forum/ubb ... mber=17794
and it fails on Update method too. But vector tracking in Optitrack SDK Sample Application works good.
Thanks for help, Mark
code:
CoInitialize(NULL);
CComPtr cameraCollection;
CComPtr camera;
CComPtr frame;
CComPtr vector;
cameraCollection.CoCreateInstance(CLSID_NPCameraCollection);
vector.CoCreateInstance(CLSID_NPVector);
cameraCollection->Enum();
long cameraCount = 0;
cameraCollection->get_Count(&cameraCount);
if(cameraCount==1)
{
cameraCollection->Item(0, &camera);
camera->Open();
camera->SetOption(NP_OPTION_VIDEO_TYPE,(CComVariant) 2 );
camera->SetOption(NP_OPTION_FRAME_DECIMATION,(CComVariant) 0 );
camera->SetOption(NP_OPTION_NUMERIC_DISPLAY_ON, (CComVariant)32);
camera->SetOption(NP_OPTION_FRAME_RATE,(CComVariant) 25);
camera->SetOption(NP_OPTION_THRESHOLD,(CComVariant) 150);
camera->SetOption(NP_OPTION_EXPOSURE,(CComVariant) 55);
camera->SetOption(NP_OPTION_INTENSITY,(CComVariant) 1);
camera->SetOption(NP_OPTION_MINIMUM_SEGMENT_LENGTH,(CComVariant) 75);
camera->SetOption(NP_OPTION_MAXIMUM_SEGMENT_LENGTH,(CComVariant) 200);
camera->Start();
camera->GetFrame(0, &frame);
vector->Reset();
vector->Update(camera,frame); // HERE IT FAILS
.
.
.
camera->Stop();
camera->Close();
camera.Release();
vector.Release();
}
cameraCollection.Release();
CoUninitialize();
ExitProcess(1);