pyorbbec 1.0.1.7__py3-none-any.whl → 1.0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyorbbec-1.0.1.7.dist-info → pyorbbec-1.0.1.8.dist-info}/METADATA +1 -1
- pyorbbec-1.0.1.8.dist-info/RECORD +59 -0
- pyorbbecsdk/examples/.gitkeep +0 -0
- pyorbbecsdk/examples/OrbbecSDK.dll +0 -0
- pyorbbecsdk/examples/OrbbecSDK.lib +0 -0
- pyorbbecsdk/examples/README.md +26 -0
- pyorbbecsdk/examples/__pycache__/utils.cpython-313.pyc +0 -0
- pyorbbecsdk/examples/callback.py +303 -0
- pyorbbecsdk/examples/color.py +64 -0
- pyorbbecsdk/examples/coordinate_transform.py +184 -0
- pyorbbecsdk/examples/depth.py +107 -0
- pyorbbecsdk/examples/depth_work_mode.py +50 -0
- pyorbbecsdk/examples/device_firmware_update.py +155 -0
- pyorbbecsdk/examples/device_optional_depth_presets_update.py +142 -0
- pyorbbecsdk/examples/enumerate.py +118 -0
- pyorbbecsdk/examples/extensions/depthengine/depthengine.dll +0 -0
- pyorbbecsdk/examples/extensions/depthengine/depthengine.lib +0 -0
- pyorbbecsdk/examples/extensions/filters/FilterProcessor.dll +0 -0
- pyorbbecsdk/examples/extensions/filters/ob_priv_filter.dll +0 -0
- pyorbbecsdk/examples/extensions/firmwareupdater/firmwareupdater.dll +0 -0
- pyorbbecsdk/examples/extensions/frameprocessor/ob_frame_processor.dll +0 -0
- pyorbbecsdk/examples/hdr.py +216 -0
- pyorbbecsdk/examples/hot_plug.py +160 -0
- pyorbbecsdk/examples/hw_d2c_align.py +135 -0
- pyorbbecsdk/examples/imu.py +60 -0
- pyorbbecsdk/examples/infrared.py +115 -0
- pyorbbecsdk/examples/logger.py +55 -0
- pyorbbecsdk/examples/metadata.py +64 -0
- pyorbbecsdk/examples/multi_device.py +169 -0
- pyorbbecsdk/examples/multi_streams.py +219 -0
- pyorbbecsdk/examples/net_device.py +158 -0
- pyorbbecsdk/examples/playback.py +277 -0
- pyorbbecsdk/examples/point_cloud.py +90 -0
- pyorbbecsdk/examples/post_processing.py +119 -0
- pyorbbecsdk/examples/preset.py +67 -0
- pyorbbecsdk/examples/pyorbbecsdk.cp313-win_amd64.pyd +0 -0
- pyorbbecsdk/examples/quick_start.py +90 -0
- pyorbbecsdk/examples/recorder.py +236 -0
- pyorbbecsdk/examples/requirements.txt +9 -0
- pyorbbecsdk/examples/save_image_to_disk.py +106 -0
- pyorbbecsdk/examples/sync_align.py +109 -0
- pyorbbecsdk/examples/two_devices_sync.py +233 -0
- pyorbbecsdk/examples/utils.py +127 -0
- pyorbbec-1.0.1.7.dist-info/RECORD +0 -18
- {pyorbbec-1.0.1.7.dist-info → pyorbbec-1.0.1.8.dist-info}/WHEEL +0 -0
- {pyorbbec-1.0.1.7.dist-info → pyorbbec-1.0.1.8.dist-info}/licenses/LICENSE +0 -0
- {pyorbbec-1.0.1.7.dist-info → pyorbbec-1.0.1.8.dist-info}/licenses/NOTICE +0 -0
- {pyorbbec-1.0.1.7.dist-info → pyorbbec-1.0.1.8.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,127 @@
|
|
1
|
+
# ******************************************************************************
|
2
|
+
# Copyright (c) 2024 Orbbec 3D Technology, Inc
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:# www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
# ******************************************************************************
|
16
|
+
from typing import Union, Any, Optional
|
17
|
+
|
18
|
+
import cv2
|
19
|
+
import numpy as np
|
20
|
+
|
21
|
+
from pyorbbecsdk import FormatConvertFilter, VideoFrame
|
22
|
+
from pyorbbecsdk import OBFormat, OBConvertFormat
|
23
|
+
|
24
|
+
|
25
|
+
def yuyv_to_bgr(frame: np.ndarray, width: int, height: int) -> np.ndarray:
|
26
|
+
yuyv = frame.reshape((height, width, 2))
|
27
|
+
bgr_image = cv2.cvtColor(yuyv, cv2.COLOR_YUV2BGR_YUY2)
|
28
|
+
return bgr_image
|
29
|
+
|
30
|
+
|
31
|
+
def uyvy_to_bgr(frame: np.ndarray, width: int, height: int) -> np.ndarray:
|
32
|
+
uyvy = frame.reshape((height, width, 2))
|
33
|
+
bgr_image = cv2.cvtColor(uyvy, cv2.COLOR_YUV2BGR_UYVY)
|
34
|
+
return bgr_image
|
35
|
+
|
36
|
+
|
37
|
+
def i420_to_bgr(frame: np.ndarray, width: int, height: int) -> np.ndarray:
|
38
|
+
y = frame[0:height, :]
|
39
|
+
u = frame[height:height + height // 4].reshape(height // 2, width // 2)
|
40
|
+
v = frame[height + height // 4:].reshape(height // 2, width // 2)
|
41
|
+
yuv_image = cv2.merge([y, u, v])
|
42
|
+
bgr_image = cv2.cvtColor(yuv_image, cv2.COLOR_YUV2BGR_I420)
|
43
|
+
return bgr_image
|
44
|
+
|
45
|
+
|
46
|
+
def nv21_to_bgr(frame: np.ndarray, width: int, height: int) -> np.ndarray:
|
47
|
+
y = frame[0:height, :]
|
48
|
+
uv = frame[height:height + height // 2].reshape(height // 2, width)
|
49
|
+
yuv_image = cv2.merge([y, uv])
|
50
|
+
bgr_image = cv2.cvtColor(yuv_image, cv2.COLOR_YUV2BGR_NV21)
|
51
|
+
return bgr_image
|
52
|
+
|
53
|
+
|
54
|
+
def nv12_to_bgr(frame: np.ndarray, width: int, height: int) -> np.ndarray:
|
55
|
+
y = frame[0:height, :]
|
56
|
+
uv = frame[height:height + height // 2].reshape(height // 2, width)
|
57
|
+
yuv_image = cv2.merge([y, uv])
|
58
|
+
bgr_image = cv2.cvtColor(yuv_image, cv2.COLOR_YUV2BGR_NV12)
|
59
|
+
return bgr_image
|
60
|
+
|
61
|
+
|
62
|
+
def determine_convert_format(frame: VideoFrame):
|
63
|
+
if frame.get_format() == OBFormat.I420:
|
64
|
+
return OBConvertFormat.I420_TO_RGB888
|
65
|
+
elif frame.get_format() == OBFormat.MJPG:
|
66
|
+
return OBConvertFormat.MJPG_TO_RGB888
|
67
|
+
elif frame.get_format() == OBFormat.YUYV:
|
68
|
+
return OBConvertFormat.YUYV_TO_RGB888
|
69
|
+
elif frame.get_format() == OBFormat.NV21:
|
70
|
+
return OBConvertFormat.NV21_TO_RGB888
|
71
|
+
elif frame.get_format() == OBFormat.NV12:
|
72
|
+
return OBConvertFormat.NV12_TO_RGB888
|
73
|
+
elif frame.get_format() == OBFormat.UYVY:
|
74
|
+
return OBConvertFormat.UYVY_TO_RGB888
|
75
|
+
else:
|
76
|
+
return None
|
77
|
+
|
78
|
+
|
79
|
+
def frame_to_rgb_frame(frame: VideoFrame) -> Union[Optional[VideoFrame], Any]:
|
80
|
+
if frame.get_format() == OBFormat.RGB:
|
81
|
+
return frame
|
82
|
+
convert_format = determine_convert_format(frame)
|
83
|
+
if convert_format is None:
|
84
|
+
print("Unsupported format")
|
85
|
+
return None
|
86
|
+
print("covert format: {}".format(convert_format))
|
87
|
+
convert_filter = FormatConvertFilter()
|
88
|
+
convert_filter.set_format_convert_format(convert_format)
|
89
|
+
rgb_frame = convert_filter.process(frame)
|
90
|
+
if rgb_frame is None:
|
91
|
+
print("Convert {} to RGB failed".format(frame.get_format()))
|
92
|
+
return rgb_frame
|
93
|
+
|
94
|
+
|
95
|
+
def frame_to_bgr_image(frame: VideoFrame) -> Union[Optional[np.array], Any]:
|
96
|
+
width = frame.get_width()
|
97
|
+
height = frame.get_height()
|
98
|
+
color_format = frame.get_format()
|
99
|
+
data = np.asanyarray(frame.get_data())
|
100
|
+
image = np.zeros((height, width, 3), dtype=np.uint8)
|
101
|
+
if color_format == OBFormat.RGB:
|
102
|
+
image = np.resize(data, (height, width, 3))
|
103
|
+
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
104
|
+
elif color_format == OBFormat.BGR:
|
105
|
+
image = np.resize(data, (height, width, 3))
|
106
|
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
107
|
+
elif color_format == OBFormat.YUYV:
|
108
|
+
image = np.resize(data, (height, width, 2))
|
109
|
+
image = cv2.cvtColor(image, cv2.COLOR_YUV2BGR_YUYV)
|
110
|
+
elif color_format == OBFormat.MJPG:
|
111
|
+
image = cv2.imdecode(data, cv2.IMREAD_COLOR)
|
112
|
+
elif color_format == OBFormat.I420:
|
113
|
+
image = i420_to_bgr(data, width, height)
|
114
|
+
return image
|
115
|
+
elif color_format == OBFormat.NV12:
|
116
|
+
image = nv12_to_bgr(data, width, height)
|
117
|
+
return image
|
118
|
+
elif color_format == OBFormat.NV21:
|
119
|
+
image = nv21_to_bgr(data, width, height)
|
120
|
+
return image
|
121
|
+
elif color_format == OBFormat.UYVY:
|
122
|
+
image = np.resize(data, (height, width, 2))
|
123
|
+
image = cv2.cvtColor(image, cv2.COLOR_YUV2BGR_UYVY)
|
124
|
+
else:
|
125
|
+
print("Unsupported color format: {}".format(color_format))
|
126
|
+
return None
|
127
|
+
return image
|
@@ -1,18 +0,0 @@
|
|
1
|
-
pyorbbec-1.0.1.7.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
2
|
-
pyorbbec-1.0.1.7.dist-info/licenses/NOTICE,sha256=HGutM36evF5jV29JFjgiEnEDjEzOJ2D7rcTKa-BRlhg,34
|
3
|
-
pyorbbecsdk/OrbbecSDK.dll,sha256=XLrZ9iNk4LBeeTfF-Vg3re7d5QpMX8zm_MItJoSwDHI,5578752
|
4
|
-
pyorbbecsdk/OrbbecSDK.lib,sha256=-YPC20qqE2pHA4O9LD5r1PnRDODKC3fsqJi1D_g-Zdc,87364
|
5
|
-
pyorbbecsdk/OrbbecSDKConfig.xml,sha256=K8UO1coFe_DK_ZXFdjkyoeq0pL4BHYInhD_yv4BiSt4,116521
|
6
|
-
pyorbbecsdk/__init__.py,sha256=03B3LOLwYnfJD60j-wmz1nwuOMHLPnO3fJtJN8-tfEM,558
|
7
|
-
pyorbbecsdk/__version__.py,sha256=A7lTxKw06iHB99ygtvk_bxIr7wFSg3VghDAYWNEB_Sk,324
|
8
|
-
pyorbbecsdk/pyorbbecsdk.cp313-win_amd64.pyd,sha256=kFT29d743T-iy1QHWmvElOvkfA3-86RcM9GK3JrrwPc,1330688
|
9
|
-
pyorbbecsdk/extensions/depthengine/depthengine.dll,sha256=wBTUpKUOdczTdfocLQP9HIyGu-erP24fgQLK8QPkwww,355328
|
10
|
-
pyorbbecsdk/extensions/depthengine/depthengine.lib,sha256=jGOeCkxG97Dxe3DXWdx9NjMO8pDhWiVo3uJpO5x_b7A,5194
|
11
|
-
pyorbbecsdk/extensions/filters/FilterProcessor.dll,sha256=rq4cw-PbOAKwzGH_LsngxBHnpOCC9MNHojbQGDZeO64,93696
|
12
|
-
pyorbbecsdk/extensions/filters/ob_priv_filter.dll,sha256=qSGeHXBpq4lKf-dwbbJPsSErE-IBiAov3GRPDszfS7c,69120
|
13
|
-
pyorbbecsdk/extensions/firmwareupdater/firmwareupdater.dll,sha256=MBblwWX3ObOmQCynki4MUOvHPNet7Je9Qo72doHmpew,192512
|
14
|
-
pyorbbecsdk/extensions/frameprocessor/ob_frame_processor.dll,sha256=LseGWdK6xzq9Ab4QClFqVAz0SsTeDGTgg3hImJRCiA8,149504
|
15
|
-
pyorbbec-1.0.1.7.dist-info/METADATA,sha256=wUqqaEjnNJhTqBdYZy43v_NCuDp465Lx_-6UEHJYJ8k,631
|
16
|
-
pyorbbec-1.0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
17
|
-
pyorbbec-1.0.1.7.dist-info/top_level.txt,sha256=VtEe2PLpfyn__4hM0LpuzMtTVwgzui9ou5Tox-0-nDI,12
|
18
|
-
pyorbbec-1.0.1.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|