(info: DeviceInfo)
| 95 | |
| 96 | |
| 97 | def _get_device(info: DeviceInfo) -> Any: |
| 98 | ob = _ob() |
| 99 | ctx = ob.Context() |
| 100 | devices = ctx.query_devices() |
| 101 | if info.get("serial"): |
| 102 | return devices.get_device_by_serial_number(info["serial"]) |
| 103 | if info.get("uid"): |
| 104 | return devices.get_device_by_uid(info["uid"]) |
| 105 | return devices.get_device_by_index(int(info["index"])) |
| 106 | |
| 107 | |
| 108 | def _reshape_color(data: np.ndarray, height: int, width: int, channels: int) -> np.ndarray: |