I try to use the function GetFrameImage(&oFrame,355,290,0,8,&buffer[0]). But when I try to output buffer, I find buffer is empty. So I search online and find oFrame == 0.
I do not know why. My code is as follows.
int main(int argc, char* argv[])
{
INPCameraCollection *oCameraCollection;
INPCamera *oCamera;
INPCameraFrame *oFrame;
LONG misc;
LONG WIDTH;
LONG HEIGHT;
HRESULT hr;
CoInitialize(NULL); // Startup Microsoft crap
CoCreateInstance(__uuidof(NPCameraCollection) , NULL, CLSCTX_ALL,__uuidof(INPCameraCollection), (void **) &oCameraCollection);
CoCreateInstance(__uuidof(NPCamera) , NULL, CLSCTX_ALL,__uuidof(INPCamera) , (void **) &oCamera);
CoCreateInstance(__uuidof(NPCameraFrame) , NULL, CLSCTX_ALL,__uuidof(INPCameraFrame) , (void **) &oFrame);
printf("Hello World \n");
oCameraCollection->Enum();
//LONG* count;
//oCameraCollection->get_Count(count);
//printf("Camera number = %ld \n", count);
oCameraCollection->Item(0, &oCamera);
oCamera->get_SerialNumber(&misc);
//printf("serial number = %ld \n", misc);
coutOpen();
printf("Camera->Open \n");
oCamera->Start();
printf("Camera->Start \n");
if(oCamera->get_Width(&WIDTH)== S_OK)
{
coutGetFrame(0,&oFrame);
if (FAILED(hr))
{
cout GetFrameImage(&oFrame[0],355,290,0,8,&buffer[0]) == S_OK)
{
for(int i = 0; i GetFrameImage" Free();
}
}
Problem with GetFrame(0,&oFrame);
Re: Problem with GetFrame(0,&oFrame);
This first thing you might want to do is reference our very simple C++ OptiTrack SDK sample which demonstrates how to grab an image to a buffer and display it.
Its the one called ""C++ Grayscale Sample" on the OptiTrack sample applications page .
Its the one called ""C++ Grayscale Sample" on the OptiTrack sample applications page .