Hello,
I’m trying to grab successive frames from the pixy, but I seem to be running into issues if I try to grab more than one frame. I’m using this code snippet that I found on another forum post:
for(;;){
int return_value = pixy_command("cam_getFrame", // String id for remote procedure
0x01, 0x21, // mode
0x02, 0, // X-offset
0x02, 0, // Y-offset
0x02, 320, // width
0x02, 200, // height
END, // separator
&response, // pointer to the memory address for return value
&fourcc,
&renderflags,
&width,
&height,
&numPixels,
&pixels, // pointer to memory address for returned frame
END);
printf("return value: %d\n", return_value);
printf("response value :%d\n", response);
printf("num pixels: %d\n", numPixels);
usleep(1000000);
}
Here is an example of the output that I get:
return value: 0 response value :0 num pixels: 64000 return value: 0 response value :0 num pixels: 64000 return value: -1 response value :0 num pixels: 64000 return value: -1 response value :0 num pixels: 64000 return value: -3 response value :0 num pixels: 64000 return value: -3 response value :0 num pixels: 64000
It seems that the initial frame gets pulled down just fine, but somewhat non-deterministically the I am unable to grab frames from the camera after that. Am I using the api wrong? Thanks in advance.
