- unsigned char* ARDevice::videoGetImage(void)
- {
- DWORD wait_result=0;
- //unsigned char* pData;//=pixelBuffer;
- if (pGraphManager == NULL) return (NULL);
- if (bufferCheckedOut) {
- if (FAILED(pGraphManager->CheckinMemoryBuffer(g_Handle))) return (NULL);
- bufferCheckedOut = false;
- }
- wait_result = pGraphManager->WaitForNextSample(0);
- if (wait_result == WAIT_OBJECT_0) {
- HRESULT hr=pGraphManager->CheckoutMemoryBuffer(&(g_Handle), &pixelBuffer, NULL, NULL, NULL, &(g_Handle.t));
- if (FAILED(hr)) return NULL;
- bufferCheckedOut = true;
- return pixelBuffer;
- }
- }
复制代码 还有一个是获取图像的函数,pixelbuffer类成员变量。这么写运行是没有问题。但是如果按照artoolkit中函数内定义一个指针变量 ,就总是报错。
还有WaitForNextSample(0)后面的值设置里0才好使,其他值就不能用了
而artoolkit中设置为-1都没问题 |