Get OpenCV to recognize Basler camera

cvfresh report abuse

I have OpenCV and PyPylon successfully installed, but I can't seem to figure out how to get OpenCV to access the camera (Basler USB Pulse) as it would a regular camera (i.e. with cv2.VideoCapture(0)). Is there a simple way to do this?

Thank you!



WeepingAngel report abuse

Hi cvfresh,

There is a complete project on this site with a long example of this:

the essence is though:

import pypylon.pylon as py
icam = py.InstantCamera(py.TlFactory.GetInstance().CreateFirstDevice())

icam.PixelFormat = "RGB8"

img = icam.GrabOne(4000)

img = img.Array

now you should have a openCV compatible image which can be used (for example)

cv2.cvtColor(img, cv2.COLOR_RGB2BGR)


Add Answer