basler / gst-plugin-pylon

The official GStreamer plug-in for Basler cameras
BSD 3-Clause "New" or "Revised" License
40 stars 9 forks source link

I want to use Pylonsrc in Python #77

Closed jooyeop closed 7 months ago

jooyeop commented 7 months ago

I'm using 2 basler, and I'd like to use both in one Python script. I'm curious about the parameters that can operate both cameras. If you connect both cameras and use the code below, you will get an error.

It only works when one camera is connected, but I'm curious about the parameters available on Python.

cap_pylon = cv2.VideoCapture("pylonsrc " "cam::PixelFormat=YUV422_YUYV_Packed " "cam::GainRaw=150 ! " "video/x-raw,width=1920,height=1200,format=YUY2 ! " "videoconvert ! " "video/x-raw,format=BGR ! " "appsink", cv2.CAP_GSTREAMER)

thiesmoeller commented 7 months ago

When using multiple cameras, you have to select the cameras. See about selecting here: https://github.com/basler/gst-plugin-pylon#camera-selection

jooyeop commented 7 months ago

When using multiple cameras, you have to select the cameras. See about selecting here: https://github.com/basler/gst-plugin-pylon#camera-selection

I looked at it and used it on Python as below, but I couldn't use it.

cap_pylon = cv2.VideoCapture("pylonsrc device-index = number or device-serial-number = 'number' " "cam::PixelFormat=YUV422_YUYV_Packed " "cam::GainRaw=150 ! " "video/x-raw,width=1920,height=1200,format=YUY2 ! " "videoconvert ! " "video/x-raw,format=BGR ! " "appsink", cv2.CAP_GSTREAMER)

thiesmoeller commented 7 months ago

Five lines later there are examples: https://github.com/basler/gst-plugin-pylon#examples

E.g. First camera device-index=0 Second camera device-index=1 ...

jooyeop commented 7 months ago

다섯 줄 뒤에는 예제가 있습니다: https://github.com/basler/gst-plugin-pylon#examples

예: 첫 번째 카메라 device-index=0 두 번째 카메라 device-index=1 ...

cap_pylon = cv2.VideoCapture("pylonsrc device-index = 0 " "cam::PixelFormat=YUV422_YUYV_Packed " "cam::GainRaw=150 ! " "video/x-raw,width=1920,height=1200,format=YUY2 ! " "videoconvert ! " "video/x-raw,format=BGR ! " "appsink", cv2.CAP_GSTREAMER)

cap_pylon2 = cv2.VideoCapture("pylonsrc device-index = 1" "cam::PixelFormat=YUV422_YUYV_Packed " "cam::GainRaw=150 ! " "video/x-raw,width=1920,height=1200,format=YUY2 ! " "videoconvert ! " "video/x-raw,format=BGR ! " "appsink", cv2.CAP_GSTREAMER)

Should I write it like above and use it? There was an error a few days ago, but I'll try it again and ask.

jooyeop commented 7 months ago

requestion