1 | initial version |
Download the Basler Pylon SDK and test the camera with the PylonViewerApp. Then test the camera with the provided SDK samples. You will see if the camera works or if there's a camera problem.
If everything's OK and the OpenCV code still doesn't work, you can change the capture code with Pylon SDK code. It's much more stable and gives you full control over the camera (it's a pity to use an expensive high-performance camera in "webcam" mode).
You can convert the captured buffer to OpenCV Mat:
//.... Initialize the camera according to the camera class you want to use
Cam.Open();
W=Cam.Width.GetValue();H=Cam.Height.GetValue();
//.... start the capturing with the chosen grab strategy
Cam.RetrieveResult( 1000, ptrGrabResult, TimeoutHandling_ThrowException);
char* buffer=ptrGrabResult->GetBuffer();
cv::Mat image(H,W,CV_8UC3,buffer);
//.... process the image in OpenCV
Using the SDK is more work then the simple OpenCV interface, but believe me, it pays off later.