baoshiwei
2025-04-22 88fc0f9f9b7fd3eb81c958ca41ed822cf3657c47
onnx/cam_util.py
ÎļþÃû´Ó cam_util.py ÐÞ¸Ä
@@ -22,14 +22,23 @@
        for device in webcams:
            name = getattr(device, 'Name', None)
            pnp_class = getattr(device, 'PNPClass', None)
            if pnp_class == 'Camera':
                # å°†è®¾å¤‡åå­—和索引添加到字典中
                print(f"{name},{pnp_class}")
            if name is not None and self.cam1 in name:
                # å°†è®¾å¤‡åå­—和索引添加到字典中
                webcam_dict[self.cam1] = index
                index += 1
            elif name is not None and self.cam2 in name:
                # å°†è®¾å¤‡åå­—和索引添加到字典中
                webcam_dict[self.cam2] = index
                index += 1
            self.webcam_list = webcam_dict
        print(webcam_dict)
        # æŒ‰åç§°é‡æ–°æŽ’序
        webcam_dict = dict(sorted(webcam_dict.items(), key=lambda x: x[0]))
        print(webcam_dict)
        return webcam_dict