we have implemented a class derived of the CameraLibrary::cCameraListener so we receive in its callback (FrameAvailable()) the new frames. We create an object of that class for each one of the cameras.
At the beginning of the method FrameAvailable(), we ask the OS for a time counter:
Code: Select all
void CCameraOptiTrackSDK_170_Final::FrameAvailable(){
/// Get the instant
LARGE_INTEGER CurrentInstant;
QueryPerformanceCounter(&CurrentInstant);
...
Code: Select all
/// Get the elapsed time
double elapsedTime = double((1000 * ( NewTime.QuadPart - m_counterCurrentFrame.QuadPart ) / double(m_counterFreq.QuadPart)) );
Where NewTime is the time counter of the new frame, m_counterCurrentFrame the time counter of the previous frame and m_counterFreq is a frequency value of the system:
Code: Select all
QueryPerformanceFrequency(&m_counterFreq);