python basler 相机调用方法 USB通信 网口通讯 多台相机同时启用

from pypylon import pylon
import cv2
import numpy as np


class BaslerCameras:
    def __init__(self, interface_type, width, height, exposure, gain):
        """
        初始化 BaslerCamera 类
        :param interface_type: 接口类型 ('GigE' 或 'USB')
        :param width: 图像宽度
        :param height: 图像高度
        :param exposure: 曝光时间(微秒)
        :param gain: 增益
        """
        self.interface_type = interface_type
        self.camera = None
        self.width = width
        self.height = height
        self.exposure = exposure
        self.gain = gain

        # 初始化 Pylon 系统
        # pylon.initialize()

        # 获取所有可用的相机
        self.camera_list = pylon.TlFactory.GetInstance().EnumerateDevices()

        if not self.camera_list:
            raise RuntimeError("No camera detected")

        # 根据接口类型选择相机
        self.select_camera()

        # 配置相机参数
        self.camera.Width = self.width
        self.camera.Height = self.height
        self.camera.Exposu
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值