@@ -48,9 +48,125 @@ def __str__(self):
48
48
def __eq__ (self , other ):
49
49
return self .__impl == other ._Camera__impl
50
50
51
+ def capture_2d_3d (self , settings ):
52
+ """Capture a 2D+3D frame.
53
+
54
+ This method captures both a 3D point cloud and a 2D color image. Use this method when you want to capture
55
+ colored point clouds. This method will throw if `Settings.color` is not set. Use `capture_3d` for capturing a 3D
56
+ point cloud without a 2D color image.
57
+
58
+ These remarks below apply for all capture functions:
59
+
60
+ This method returns right after the acquisition of the images is complete, and the camera has stopped projecting
61
+ patterns. Therefore, after this method has returned, the camera can be moved, or objects in the scene can be
62
+ moved, or a capture from another camera with overlapping field of view can be triggered, without affecting the
63
+ point cloud.
64
+
65
+ When this method returns, there is still remaining data to transfer from the camera to the PC, and the
66
+ processing of the final point cloud is not completed. Transfer and processing of the point cloud will continue
67
+ in the background. When you call a method on the returned `Frame` object that requires the capture to be
68
+ finished, for example `Frame.point_cloud`, that method will block until the processing is finished and the point
69
+ cloud is available. If an exception occurs after the acquisition of images is complete (during transfer or
70
+ processing of the capture), then that exception is instead thrown when you access the `Frame` object.
71
+
72
+ The capture functions can be invoked back-to-back, for doing rapid back-to-back acquisition of multiple (2D or
73
+ 3D) captures on the same camera. This is for example useful if you want to do one high-resolution 2D capture
74
+ followed by a lower-resolution 3D capture. The acquisition of the next capture will begin quickly after
75
+ acquisition of the previous capture completed, even when there is remaining transfer and processing for the
76
+ first capture. This allows pipelining several 2D and/or 3D captures, by doing acquisition in parallel with data
77
+ transfer and processing.
78
+
79
+ Note: There can be maximum of two in-progress uncompleted 3D (or 2D+3D) captures simultaneously per Zivid
80
+ camera. If you invoke `capture_2d_3d` or `capture_3d` when there are two uncompleted 3D captures in-progress,
81
+ then the capture will not start until the first of the in-progress 3D captures has finished all transfer and
82
+ processing. There is a similar limit of maximum two in-process 2D captures per camera.
83
+
84
+ Capture functions can also be called on multiple cameras simultaneously. However, if the cameras have
85
+ overlapping field-of-view then you need to take consideration and sequence the capture calls to avoid the
86
+ captures interfering with each other.
87
+
88
+ Args:
89
+ settings: Settings to use for the capture.
90
+
91
+ Returns:
92
+ A frame containing a 3D point cloud, a 2D color image, and metadata.
93
+
94
+ Raises:
95
+ TypeError: If the settings argument is not a Settings instance.
96
+ """
97
+ if not isinstance (settings , Settings ):
98
+ raise TypeError (
99
+ "Unsupported type for argument settings. Got {}, expected {}." .format (
100
+ type (settings ), Settings .__name__
101
+ )
102
+ )
103
+ return Frame (self .__impl .capture_2d_3d (_to_internal_settings (settings )))
104
+
105
+ def capture_3d (self , settings ):
106
+ """Capture a single 3D frame.
107
+
108
+ This method is used to capture a 3D frame without a 2D color image. It ignores all color settings in the input
109
+ settings. See `capture_2d_3d` for capturing a 2D+3D frame.
110
+
111
+ This method returns right after the acquisition of the images is complete, and the camera has stopped projecting
112
+ patterns. For more information, see the remarks section of `capture_2d_3d` above. Those remarks apply for both
113
+ 2D, 3D, and 2D+3D captures.
114
+
115
+ Args:
116
+ settings: Settings to use for the capture.
117
+
118
+ Returns:
119
+ A frame containing a 3D point cloud and metadata.
120
+
121
+ Raises:
122
+ TypeError: If the settings argument is not a Settings
123
+ """
124
+ if not isinstance (settings , Settings ):
125
+ raise TypeError (
126
+ "Unsupported type for argument settings. Got {}, expected {}." .format (
127
+ type (settings ), Settings .__name__
128
+ )
129
+ )
130
+ return Frame (self .__impl .capture_3d (_to_internal_settings (settings )))
131
+
132
+ def capture_2d (self , settings ):
133
+ """Capture a single 2D frame.
134
+
135
+ This method returns right after the acquisition of the images is complete, and the camera has stopped projecting
136
+ patterns. For more information, see the remarks section of `capture_2d_3d` above. Those remarks apply for both
137
+ 2D, 3D, and 2D+3D captures.
138
+
139
+ Args:
140
+ settings: Settings to use for the capture. Can be either a Settings2D instance or a Settings instance.
141
+ If a Settings instance is provided, only the Settings.color part is used. An exception is thrown
142
+ if the Settings.color part is not set.
143
+
144
+ Returns:
145
+ A Frame2D containing a 2D image and metadata
146
+
147
+ Raises:
148
+ TypeError: If the settings argument is not a Settings2D or a Settings.
149
+ """
150
+ if isinstance (settings , Settings2D ):
151
+ return Frame2D (self .__impl .capture_2d (_to_internal_settings2d (settings )))
152
+ if isinstance (settings , Settings ):
153
+ return Frame2D (self .__impl .capture_2d (_to_internal_settings (settings )))
154
+ raise TypeError (
155
+ "Unsupported settings type, expected: {expected_types}, got: {value_type}" .format (
156
+ expected_types = " or " .join ([Settings .__name__ , Settings2D .__name__ ]),
157
+ value_type = type (settings ),
158
+ )
159
+ )
160
+
51
161
def capture (self , settings ):
52
162
"""Capture a single frame or a single 2D frame.
53
163
164
+ This method is deprecated as of SDK 2.14, and will be removed in the next SDK major version (3.0). Use
165
+ `capture_2d_3d` instead for capturing 2D+3D frames, use `capture_3d` for capturing 3D frames without a 2D color
166
+ image, or use `capture_2d` for capturing a 2D color image only.
167
+
168
+ This method shares the common remarks about capture functions as found under `capture_2d_3d`.
169
+
54
170
Args:
55
171
settings: Settings to be used to capture. Can be either a Settings or Settings2D instance
56
172
@@ -64,7 +180,12 @@ def capture(self, settings):
64
180
return Frame (self .__impl .capture (_to_internal_settings (settings )))
65
181
if isinstance (settings , Settings2D ):
66
182
return Frame2D (self .__impl .capture (_to_internal_settings2d (settings )))
67
- raise TypeError ("Unsupported settings type: {}" .format (type (settings )))
183
+ raise TypeError (
184
+ "Unsupported settings type, expected: {expected_types}, got: {value_type}" .format (
185
+ expected_types = " or " .join ([Settings .__name__ , Settings2D .__name__ ]),
186
+ value_type = type (settings ),
187
+ )
188
+ )
68
189
69
190
@property
70
191
def info (self ):
0 commit comments