Hi, I have 2 major questions about the camera.
1. How do I get the exact 100 frame per second?
2. Is it possible that the camera's view is asymmetric?
I have some simple test code that test the frame rate:
#define NUM_SEC 10
int _tmain(int argc, _TCHAR* argv[]) {
//== Initialize Microsoft COM Interop
CoInitialize(NULL);
//== Initialize OptiTrack COM Component
CComPtr cameraCollection;
CComPtr camera;
CComPtr frame;
cameraCollection.CoCreateInstance(CLSID_NPCameraCollection);
//== Enumerate (Identify) Available Cameras
cameraCollection->Enum();
long cameraCount = 0;
int frameCounter = 0;
//== Determine Available Cameras
cameraCollection->get_Count(&cameraCount);
printf("%d Camera(s) Detected:\n\n", cameraCount);
clock_t endwait;
endwait = clock () + NUM_SEC * CLOCKS_PER_SEC;
if(cameraCount>0)
{
cameraCollection->Item(0, &camera);
//2 = processed video with final objects built in the camera.
camera->SetOption(NP_OPTION_VIDEO_TYPE , (CComVariant) 2 );
//send null frames
camera->SetOption(NP_OPTION_SEND_EMPTY_FRAMES, (CComVariant)VARIANT_TRUE);
camera->Open();
camera->Start();
frameCounter = 0;
int fail = 0;
while (clock() GetFrame(INFINITE, &frame) != S_OK)
printf("aa");
if(frame) {
frame->Free();
frame.Release();
frameCounter++;
}
else {
fail++;
}
}
printf ( "%d frames, %d null ptrs per %d sec\n", frameCounter, fail, NUM_SEC);
getchar();
}
}
I did some search on the forum and I remember in one thread someone said that if I tell the camera to send me NULL pointers, I should be able to get exactly 100hz, but the output for this piece of code is something looks like this:
100 frames, 40016607 null ptrs per 10 sec
Also I have some trouble understanding with getFrame with INFINITE timeout. If no trackers are present, does the camera block until something shows up? Or it still gives a null pointer? I remember some one said I will never get null frames with INFINITE time out, but this is not true in my experience.
Can anyone tell me why?
For question 2, we mounted the camera some distance above a table and I am pretty sure whoever mounted the it did a great job to make it centered and parallel to the table. But the gray scale image or testing with actual trackers showed that the view was not centered. It sees more on the left than on the right(with respect to the cam). I am confused why this is happening.
Thank you very much for your time!
2 questions about FLEX:V100
Re: 2 questions about FLEX:V100
Hi, anyone has any ideas???
I really appreciate any help here.
Thanks!
I really appreciate any help here.
Thanks!
Re: 2 questions about FLEX:V100
If you are trying to aim a camera, its better to do it using the image data instead of the physical camera body.
I modified your inner loop and included the message pump from the console sample. It seemed to work ok after that. You might want to also consider adding a short Sleep() in the loop.
"992 frames, 14814710 null ptrs per 10 sec"
I modified your inner loop and included the message pump from the console sample. It seemed to work ok after that. You might want to also consider adding a short Sleep() in the loop.
"992 frames, 14814710 null ptrs per 10 sec"
Code: Select all
MSG msg;
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if(GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
if(S_OK == camera->GetFrame(INFINITE, &frame))
{
if(frame)
{
frame->Free();
frame.Release();
frameCounter++;
}
else
{
fail++;
}
}