2

I'm pretty stuck on a problem with my uEye camera. Using my laptop camera (id 0) or internet camera on usb (id 1) this line works perfectly: TheVideoCapturer.open(1); (TheVideoCapturer is of VideoCapture class, OpenCV).

Unfortunately, when I try to do the same with my uEye camera, it can't find it. I checked the camera ID in the ueyecameramanager, and it's 1. Or 35, in some expert mode. I'd like to use it the same way I used mentioned above cameras.

I've got the drivers, because, well, the ueyecameramanager works and gives me some stream, and ROS node ueye_cam works fine as well .

Any sort of advice would be gladly appreciated.

hubeek
  • 35
  • 1
  • 5

1 Answers1

4

Even though you have probably already figured it out as far as I know you cannot use VideoCapture directly with uEye cameras. You have to use their own SDK to access the videostream (or take a single snapshot depending on your case). After that you can use memcpy() to copy the memory that is pointed by void pointer filled by is:GetImageMem(...) to the Mat object (cv::Mat::ptr()). If you look close enough what the ROS node for uEye does it actually uses the functions provided by the uEye SDK to set and access the camera. ROS also has its own image format and that is why an interface is implemented (called cv_bridge) to convert ROS images to OpenCV images. Overall it's a ridiculous salad of data copying and conversion but since this is how things currently are you don't have much of a choice there.

rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
  • Yup, this is exactly what I had to do. Funny thing, VideoCapture DOES work with uEye cameras... but not on Linux. On Windows you can just do the VideoCapturer.open(1) and you're good to go. On Linux you have to doodle with pointers and all that. – hubeek Jan 08 '15 at 16:46
  • Oh, this is nice to know. I'm going to try this out on Windows. However such a thing will render your code unusable on a Linux machine. Of course this matters only if you want to go multiplatform, which - sadly - is my case. :D – rbaleksandar Jan 09 '15 at 09:11
  • @hubeek I do have the problem of operating a uEye camera on python under windows and it doesn't really work. I posted this question (http://stackoverflow.com/questions/40563139/ueye-camera-with-python-on-windows) so maybe you can help out there. – ImportanceOfBeingErnest Nov 12 '16 at 13:11
  • @hubeek The reason it does not work on Linux is that the ueye driver does not implement the standard linux framework v4l2, and therefore the camera is not available through /dev/videoX, unfortunately. – Étienne Jan 13 '20 at 14:07
  • @Étienne Before I quit my job there (yeap, worked for a little bit last year in the company producing the cameras) I do recall the v4l2 landing on the TODO features list. When and if it will be available is a different thing. – rbaleksandar Feb 02 '21 at 10:47