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)


rishabh-sharma report abuse

I have a question..... I was trying to use pypylon on my pc. Do i need pylon with development option ??

mmueller report abuse

Download and install pypylon on your system:

mattb report abuse

FYI, I've created a github to make some various sample programs based on PyPylon:

If you end up learning some tips and tricks when using OpenCV and PyPylon and would like to share, let me know and I'm happy to add them into my PyPylonOpenCV sample :). Thanks!

Add Answer

Need support?

Just drop us an email to ... Show more Arrow right