Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit f619414

Browse files
Pyreach sync 20220518
1 parent db79755 commit f619414

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7484
-760
lines changed

pyreach/color_camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def color_image(self) -> np.ndarray:
6262

6363
@property
6464
def calibration(self) -> Optional[calibration.Calibration]:
65-
"""Return the Calibration for for the ColorFrame."""
65+
"""Return the Calibration for the ColorFrame."""
6666
raise NotImplementedError
6767

6868
def pose(self) -> Optional[core.Pose]:

pyreach/common/proto_gen/calibration_pb2.py

Lines changed: 514 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
@generated by mypy-protobuf. Do not edit manually!
17+
isort:skip_file
18+
"""
19+
import builtins
20+
import frame_context_pb2
21+
import google.protobuf.descriptor
22+
import google.protobuf.internal.containers
23+
import google.protobuf.message
24+
import interval_pb2
25+
import pose_pb2
26+
import stats_pb2
27+
import typing
28+
import typing_extensions
29+
import vector_pb2
30+
31+
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
32+
33+
class CameraSpecification(google.protobuf.message.Message):
34+
"""---------------------------------------------------------------------------
35+
Stats - Error statistics for calibration.
36+
37+
Where error is represented as a Stats protobuf, the represented value is the
38+
per-pixel error of the metric.
39+
40+
The average per-pixel scalar error will be saved in Stats.mean.
41+
The total error can be calculated as Stats.mean * Stats.count
42+
---------------------------------------------------------------------------
43+
44+
Specifications for an ideal camera.
45+
"""
46+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
47+
class ImageSpec(google.protobuf.message.Message):
48+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
49+
COLS_FIELD_NUMBER: builtins.int
50+
ROWS_FIELD_NUMBER: builtins.int
51+
CHANNELS_FIELD_NUMBER: builtins.int
52+
cols: builtins.int
53+
"""Dimensions and encoding type of camera images."""
54+
55+
rows: builtins.int
56+
channels: builtins.int
57+
def __init__(self,
58+
*,
59+
cols: builtins.int = ...,
60+
rows: builtins.int = ...,
61+
channels: builtins.int = ...,
62+
) -> None: ...
63+
def ClearField(self, field_name: typing_extensions.Literal["channels",b"channels","cols",b"cols","rows",b"rows"]) -> None: ...
64+
65+
IMAGE_SPEC_FIELD_NUMBER: builtins.int
66+
FOV_FIELD_NUMBER: builtins.int
67+
CLIP_FIELD_NUMBER: builtins.int
68+
@property
69+
def image_spec(self) -> global___CameraSpecification.ImageSpec: ...
70+
@property
71+
def fov(self) -> vector_pb2.Vector2d:
72+
"""Field of View in screen radians for width and height."""
73+
pass
74+
@property
75+
def clip(self) -> interval_pb2.Intervald:
76+
"""Positive distance to near and far clip planes in meters.
77+
This is only used for rendering synthetic cameras as real cameras do not
78+
have clip planes.
79+
"""
80+
pass
81+
def __init__(self,
82+
*,
83+
image_spec: typing.Optional[global___CameraSpecification.ImageSpec] = ...,
84+
fov: typing.Optional[vector_pb2.Vector2d] = ...,
85+
clip: typing.Optional[interval_pb2.Intervald] = ...,
86+
) -> None: ...
87+
def HasField(self, field_name: typing_extensions.Literal["clip",b"clip","fov",b"fov","image_spec",b"image_spec"]) -> builtins.bool: ...
88+
def ClearField(self, field_name: typing_extensions.Literal["clip",b"clip","fov",b"fov","image_spec",b"image_spec"]) -> None: ...
89+
global___CameraSpecification = CameraSpecification
90+
91+
class CameraIntrinsics(google.protobuf.message.Message):
92+
"""Camera matrix and distortion parameters.
93+
94+
https://docs.opencv.org/4.x/dc/dbb/tutorial_py_calibration.html
95+
https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html
96+
Camera matrix:
97+
| fx 0 cx |
98+
| 0 fy cy |
99+
| 0 0 1 |
100+
"""
101+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
102+
FX_FIELD_NUMBER: builtins.int
103+
FY_FIELD_NUMBER: builtins.int
104+
CX_FIELD_NUMBER: builtins.int
105+
CY_FIELD_NUMBER: builtins.int
106+
K1_FIELD_NUMBER: builtins.int
107+
K2_FIELD_NUMBER: builtins.int
108+
K3_FIELD_NUMBER: builtins.int
109+
K4_FIELD_NUMBER: builtins.int
110+
K5_FIELD_NUMBER: builtins.int
111+
K6_FIELD_NUMBER: builtins.int
112+
P1_FIELD_NUMBER: builtins.int
113+
P2_FIELD_NUMBER: builtins.int
114+
EXTRA_FIELD_NUMBER: builtins.int
115+
ERROR_STATS_FIELD_NUMBER: builtins.int
116+
CAMERA_SPEC_FIELD_NUMBER: builtins.int
117+
fx: builtins.float
118+
"""Focal length in x."""
119+
120+
fy: builtins.float
121+
"""Focal length in y."""
122+
123+
cx: builtins.float
124+
"""Center in x."""
125+
126+
cy: builtins.float
127+
"""Center in y."""
128+
129+
k1: builtins.float
130+
"""(x,y) are projected coordinates in the z=1 plane.
131+
132+
f = (1 + k1r^2 + k2r^4 + k3r^6) / (1 + k4r^2 + k5r^4 + k6r^6)
133+
x' = x * f
134+
y' = y * f
135+
r^2 distortion coefficient.
136+
"""
137+
138+
k2: builtins.float
139+
"""r^4 distortion coefficient."""
140+
141+
k3: builtins.float
142+
"""r^6 distortion coefficient."""
143+
144+
k4: builtins.float
145+
"""Denominator coefficients.
146+
r^2 distortion coefficient.
147+
"""
148+
149+
k5: builtins.float
150+
"""r^4 distortion coefficient."""
151+
152+
k6: builtins.float
153+
"""r^6 distortion coefficient."""
154+
155+
p1: builtins.float
156+
"""x' += 2p1xy + p2(r^2 + 2x^2)
157+
y' += 2p2xy + p1(r^2 + 2y^2)
158+
y distortion coefficient.
159+
"""
160+
161+
p2: builtins.float
162+
"""x distortion coefficient."""
163+
164+
@property
165+
def extra(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.float]:
166+
"""Additional distortion parameters beyond k6."""
167+
pass
168+
@property
169+
def error_stats(self) -> stats_pb2.Stats:
170+
"""Accumulated scalar error for intrinsics."""
171+
pass
172+
@property
173+
def camera_spec(self) -> global___CameraSpecification:
174+
"""Camera specification includes image size in pixels and field-of-view
175+
angles.
176+
"""
177+
pass
178+
def __init__(self,
179+
*,
180+
fx: typing.Optional[builtins.float] = ...,
181+
fy: typing.Optional[builtins.float] = ...,
182+
cx: typing.Optional[builtins.float] = ...,
183+
cy: typing.Optional[builtins.float] = ...,
184+
k1: typing.Optional[builtins.float] = ...,
185+
k2: typing.Optional[builtins.float] = ...,
186+
k3: typing.Optional[builtins.float] = ...,
187+
k4: typing.Optional[builtins.float] = ...,
188+
k5: typing.Optional[builtins.float] = ...,
189+
k6: typing.Optional[builtins.float] = ...,
190+
p1: typing.Optional[builtins.float] = ...,
191+
p2: typing.Optional[builtins.float] = ...,
192+
extra: typing.Optional[typing.Iterable[builtins.float]] = ...,
193+
error_stats: typing.Optional[stats_pb2.Stats] = ...,
194+
camera_spec: typing.Optional[global___CameraSpecification] = ...,
195+
) -> None: ...
196+
def HasField(self, field_name: typing_extensions.Literal["_cx",b"_cx","_cy",b"_cy","_fx",b"_fx","_fy",b"_fy","_k1",b"_k1","_k2",b"_k2","_k3",b"_k3","_k4",b"_k4","_k5",b"_k5","_k6",b"_k6","_p1",b"_p1","_p2",b"_p2","camera_spec",b"camera_spec","cx",b"cx","cy",b"cy","error_stats",b"error_stats","fx",b"fx","fy",b"fy","k1",b"k1","k2",b"k2","k3",b"k3","k4",b"k4","k5",b"k5","k6",b"k6","p1",b"p1","p2",b"p2"]) -> builtins.bool: ...
197+
def ClearField(self, field_name: typing_extensions.Literal["_cx",b"_cx","_cy",b"_cy","_fx",b"_fx","_fy",b"_fy","_k1",b"_k1","_k2",b"_k2","_k3",b"_k3","_k4",b"_k4","_k5",b"_k5","_k6",b"_k6","_p1",b"_p1","_p2",b"_p2","camera_spec",b"camera_spec","cx",b"cx","cy",b"cy","error_stats",b"error_stats","extra",b"extra","fx",b"fx","fy",b"fy","k1",b"k1","k2",b"k2","k3",b"k3","k4",b"k4","k5",b"k5","k6",b"k6","p1",b"p1","p2",b"p2"]) -> None: ...
198+
@typing.overload
199+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_cx",b"_cx"]) -> typing.Optional[typing_extensions.Literal["cx"]]: ...
200+
@typing.overload
201+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_cy",b"_cy"]) -> typing.Optional[typing_extensions.Literal["cy"]]: ...
202+
@typing.overload
203+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_fx",b"_fx"]) -> typing.Optional[typing_extensions.Literal["fx"]]: ...
204+
@typing.overload
205+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_fy",b"_fy"]) -> typing.Optional[typing_extensions.Literal["fy"]]: ...
206+
@typing.overload
207+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_k1",b"_k1"]) -> typing.Optional[typing_extensions.Literal["k1"]]: ...
208+
@typing.overload
209+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_k2",b"_k2"]) -> typing.Optional[typing_extensions.Literal["k2"]]: ...
210+
@typing.overload
211+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_k3",b"_k3"]) -> typing.Optional[typing_extensions.Literal["k3"]]: ...
212+
@typing.overload
213+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_k4",b"_k4"]) -> typing.Optional[typing_extensions.Literal["k4"]]: ...
214+
@typing.overload
215+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_k5",b"_k5"]) -> typing.Optional[typing_extensions.Literal["k5"]]: ...
216+
@typing.overload
217+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_k6",b"_k6"]) -> typing.Optional[typing_extensions.Literal["k6"]]: ...
218+
@typing.overload
219+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_p1",b"_p1"]) -> typing.Optional[typing_extensions.Literal["p1"]]: ...
220+
@typing.overload
221+
def WhichOneof(self, oneof_group: typing_extensions.Literal["_p2",b"_p2"]) -> typing.Optional[typing_extensions.Literal["p2"]]: ...
222+
global___CameraIntrinsics = CameraIntrinsics
223+
224+
class CameraExtrinsics(google.protobuf.message.Message):
225+
"""Pose of a camera in the world frame or with respect to a named object."""
226+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
227+
WORLD_POSE_CAMERA_FIELD_NUMBER: builtins.int
228+
FRAME_CONTEXT_FIELD_NUMBER: builtins.int
229+
ERROR_STATS_FIELD_NUMBER: builtins.int
230+
@property
231+
def world_pose_camera(self) -> pose_pb2.Pose3d:
232+
"""Places the camera at an absolute position in the world."""
233+
pass
234+
@property
235+
def frame_context(self) -> frame_context_pb2.FrameContextRelative:
236+
"""Describes the camera pose relative to a, possibly moving, named frame of
237+
reference.
238+
"""
239+
pass
240+
@property
241+
def error_stats(self) -> stats_pb2.Stats:
242+
"""Accumulated scalar error for extrinsics."""
243+
pass
244+
def __init__(self,
245+
*,
246+
world_pose_camera: typing.Optional[pose_pb2.Pose3d] = ...,
247+
frame_context: typing.Optional[frame_context_pb2.FrameContextRelative] = ...,
248+
error_stats: typing.Optional[stats_pb2.Stats] = ...,
249+
) -> None: ...
250+
def HasField(self, field_name: typing_extensions.Literal["error_stats",b"error_stats","extrinsic_type",b"extrinsic_type","frame_context",b"frame_context","world_pose_camera",b"world_pose_camera"]) -> builtins.bool: ...
251+
def ClearField(self, field_name: typing_extensions.Literal["error_stats",b"error_stats","extrinsic_type",b"extrinsic_type","frame_context",b"frame_context","world_pose_camera",b"world_pose_camera"]) -> None: ...
252+
def WhichOneof(self, oneof_group: typing_extensions.Literal["extrinsic_type",b"extrinsic_type"]) -> typing.Optional[typing_extensions.Literal["world_pose_camera","frame_context"]]: ...
253+
global___CameraExtrinsics = CameraExtrinsics
254+
255+
class CameraCalibration(google.protobuf.message.Message):
256+
"""Total calibration data for a camera."""
257+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
258+
INTRINSICS_FIELD_NUMBER: builtins.int
259+
EXTRINSICS_FIELD_NUMBER: builtins.int
260+
@property
261+
def intrinsics(self) -> global___CameraIntrinsics:
262+
"""Intrinsics: image size, distortion, center, focal length"""
263+
pass
264+
@property
265+
def extrinsics(self) -> global___CameraExtrinsics:
266+
"""Extrinsics: 3D position of the camera with orientation, may be relative."""
267+
pass
268+
def __init__(self,
269+
*,
270+
intrinsics: typing.Optional[global___CameraIntrinsics] = ...,
271+
extrinsics: typing.Optional[global___CameraExtrinsics] = ...,
272+
) -> None: ...
273+
def HasField(self, field_name: typing_extensions.Literal["extrinsics",b"extrinsics","intrinsics",b"intrinsics"]) -> builtins.bool: ...
274+
def ClearField(self, field_name: typing_extensions.Literal["extrinsics",b"extrinsics","intrinsics",b"intrinsics"]) -> None: ...
275+
global___CameraCalibration = CameraCalibration

0 commit comments

Comments
 (0)