int main(int argc, char* argv[]) { // initialize PvAPI if(PvInitialize() == ePvErrSuccess) { //IMPORTANT. Initialize camera structure. See tPvFrame in PvApi.h for more info. memset(&GCamera,0,sizeof(tCamera)); // the only command line argument accepted is the IP@ of the camera to be open if(argc>1) { unsigned long IP = inet_addr(argv[1]); if(IP) { // open the camera if(CameraOpen(IP)) { ListAttributes(); // unsetup the camera CameraClose(); } else printf("Failed to open the camera (maybe not found?)\n"); } else printf("a valid IP address must be entered\n"); } else { // wait for a camera to be plugged WaitForCamera(); if(CameraGrab()) { // open the camera if(CameraOpen()) { ListAttributes(); // unsetup the camera CameraClose(); } else printf("failed to open the camera\n"); } else printf("failed to grab a camera!\n"); } // uninitialize the API PvUnInitialize(); } else printf("failed to initialize the API\n"); return 0; }
int main(int argc, char* argv[]) { // initialise the Prosilica API if(!PvInitialize()) { memset(&GCamera,0,sizeof(tCamera)); // the only command line argument accepted is the IP@ of the camera to be open if(argc>1) { unsigned long IP = inet_addr(argv[1]); if(IP) { // open the camera if(CameraOpen(IP)) { ListAttributes(); // unsetup the camera CameraClose(); } else printf("Failed to open the camera (maybe not found?)\n"); } else printf("a valid IP address must be entered\n"); } else { // wait for a camera to be plugged WaitForCamera(); if(CameraGrab()) { // open the camera if(CameraOpen()) { ListAttributes(); // unsetup the camera CameraClose(); } else printf("failed to open the camera\n"); } else printf("failed to grab a camera!\n"); } // uninitialise the API PvUnInitialize(); } else printf("failed to initialise the API\n"); return 0; }
DLLEXPORT int primCloseCamera(void) { int cameraNum; cameraNum = interpreterProxy->stackIntegerValue(0); if (interpreterProxy->failed()) { return 0; } CameraClose(cameraNum); interpreterProxy->pop(1); return 0; }
int main(int argc, char* argv[]) { // initialise the Prosilica API if(!PvInitialize()) { // the only command line argument accepted is the IP@ of the camera to be open if(argc>1) { unsigned long IP = inet_addr(argv[1]); if(IP) { tPvHandle Handle; // open the camera if((Handle = CameraOpen(IP)) != NULL) { // seek the best packet size CameraAdjust(Handle); // close the camera CameraClose(Handle); } else printf("Failed to open the camera (maybe not found?)\n"); } else printf("a valid IP address must be entered\n"); } else printf("usage : AdjustPacket <IP@>\n"); // uninitialise the API PvUnInitialize(); } else printf("failed to initialise the API\n"); return 0; }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND:{ int wmId = LOWORD(wParam); int wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_EXIT: DestroyWindow(hWnd); break; case ID_CAMERA_OPEN: CameraOpen(); break; case ID_CAMERA_CLOSE: CameraClose(); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break;} case WM_PAINT:{ PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); EndPaint(hWnd, &ps); break;} case WM_CLOSE: DestroyWindow(hWnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
void CameraOpen() { char name[256]; for (int i=0;;i++) { if (0 != imgInterfaceQueryNames(i, name)) break; dbgprintf("IMAQ interface: %s\n", name); } if (fastCMOS) CameraClose(); imgInterfaceOpen("img0", &ifid); imgSessionOpen(ifid, &session); fastCMOS = new FastCMOS(session); std::string info = fastCMOS->readInfo(); CameraConfigure(); int fps = fastCMOS->getFramerate().fps; dbgprintf("FPS: %d\n", fps); }