Ask Your Question
0

My Basler camera suddenly stopped working for no reasons

asked 2019-08-26 08:02:13 -0600

Greetings,

my problem is a vague one. Let me explain. I have a Basler camera (I think this might be the most important information about my problem). Me and my team worked with it for a long moment (2 months and a half) with the OpenCV library, everything worked well, more specifically the stream capture, until it didn't for no reason at all. We tried everything : we came back to an old version of the code, we changed the library version (3.4.6 or 3.4.7 or 4.1.1), we uninstalled-reinstalled the driver, we changed the OS to a linux one instead of Windows and we even tried an other camera (VRmC-16+/BW) but both don't work. Every time we execute the simplest test lines :

cv::VieoCapture* videoCapture = new cv::VideoCapture(0);
if (!videoCapture->isOpened()) std::cout << "Cannot open the video camera" << std::endl;

We get the message on the shell. Have you any idea what kind of tests I could make to know where the problem comes from ? I feel like it has to do with the OS not recognizing it but literally nothing changed from one night to the next morning : no windows update, no library update, no code changing. Beside, I can use the camera with the software Pylong Viewer so that confuses me even more (I'm using Windows 7).

The model of the camera is : Basler ace USB3 Vision Camera. It's a pretty expensive one with high performances so we would like to know solutions apart from "get an other one".

The only thing that worked is a webcam.

Sorry if the problem is vague but we are as confused as you are.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2019-08-27 04:01:37 -0600

kbarni gravatar image

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.

edit flag offensive delete link more

Comments

Thanks for your help. I did what you said : I used the library that Pylon uses and it works. Now I will test your code.

I am still frustrated by the "why suddenly it didn't work ?!".

Anuta Christian gravatar imageAnuta Christian ( 2019-08-30 06:05:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-08-26 08:02:13 -0600

Seen: 1,187 times

Last updated: Aug 27 '19