Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Problem getting Mat from GigE camera (Sapera SDK)

$
0
0
Hi, I am trying to get Sapera SDK SapBuffer object (Genie NANO GIgE camera) as a cv::Mat. From documentation for this sdk I know that "The SapBuffer Class includes the functionality to manipulate an array of buffer resources." From SDK I know that in "SapBuffer* Buffers" there it is 1024x1280 image type: 32 Depth: 8. I am not sure if I am correctly acquiring Mat object (rest of the code is from example for this sdk): SapLocation loc(serverName,0); Acq = new SapAcquisition(loc, FALSE); //ETHERNET came doesnt work with this? AcqDevice = new SapAcqDevice(loc, FALSE); Buffers = new SapBufferWithTrash(2, AcqDevice); View = new SapView(Buffers, SapHwndAutomatic); Xfer = new SapAcqDeviceToBuf(AcqDevice, Buffers, AcqCallback, View); // Create acquisition object if (AcqDevice && !*AcqDevice && !AcqDevice->Create()) goto FreeHandles; } // Create buffer object if (Buffers && !*Buffers && !Buffers->Create()) goto FreeHandles; // Create transfer object if (Xfer && !*Xfer && !Xfer->Create()) goto FreeHandles; // Create view object if (View && !*View && !View->Create()) goto FreeHandles; // Start continous grab Xfer->Grab(); src1 = new Mat(1024, 1280, CV_8U, Buffers); std::cout << "Total(): " << src1->total() << std::endl; //Buffers->GetAddress(pData); imwrite("E:\OpenCV\Gray_Image.jpg",*src1); //delete mat; delete src1; printf("Press any key to stop grab\n"); CorGetch(); // Stop grab Xfer->Freeze(); if (!Xfer->Wait(5000)) printf("Grab could not stop properly.\n"); Its part of an example and my code is only Mat *src1 = NULL; and OpenCv part. After running it shows "The program stopped running". Please help.

Viewing all articles
Browse latest Browse all 19555

Trending Articles