feat: Enhance play notebook and camera module with new functionalities
- Updated play notebook with additional imports and new functions for point triangulation and undistortion. - Introduced `triangulate_one_point_from_multiple_views_linear` and `triangulate_points_from_multiple_views_linear` for batch triangulation of points. - Added `triangle_from_cluster` function to facilitate triangulation from detection clusters. - Enhanced `CameraParams` and `Detection` dataclasses with a projection matrix property for improved usability. - Cleaned up imports and execution counts in the notebook for better organization.
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,7 +1,4 @@
|
|||||||
{
|
{
|
||||||
"python.analysis.typeCheckingMode": "basic",
|
"python.analysis.typeCheckingMode": "basic",
|
||||||
"python.analysis.autoImportCompletions": true,
|
"python.analysis.autoImportCompletions": true,
|
||||||
"cSpell.words": [
|
|
||||||
"triu"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
@ -13,7 +13,7 @@ CameraID: TypeAlias = str # pylint: disable=invalid-name
|
|||||||
|
|
||||||
|
|
||||||
@jaxtyped(typechecker=beartype)
|
@jaxtyped(typechecker=beartype)
|
||||||
@dataclass
|
@dataclass(frozen=True)
|
||||||
class CameraParams:
|
class CameraParams:
|
||||||
"""
|
"""
|
||||||
Camera parameters: intrinsic matrix, extrinsic matrix, and distortion coefficients
|
Camera parameters: intrinsic matrix, extrinsic matrix, and distortion coefficients
|
||||||
@ -42,9 +42,23 @@ class CameraParams:
|
|||||||
The size of image plane (width, height)
|
The size of image plane (width, height)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def projection_matrix(self) -> Num[Array, "3 4"]:
|
||||||
|
"""
|
||||||
|
Returns the 3x4 projection matrix K @ [R|t].
|
||||||
|
|
||||||
|
The result is cached on first access. (lazy evaluation)
|
||||||
|
"""
|
||||||
|
pm = getattr(self, "_proj", None)
|
||||||
|
if pm is None:
|
||||||
|
pm = self.K @ self.Rt[:3, :]
|
||||||
|
# object.__setattr__ bypasses the frozen‐dataclass blocker
|
||||||
|
object.__setattr__(self, "_proj", pm)
|
||||||
|
return pm
|
||||||
|
|
||||||
|
|
||||||
@jaxtyped(typechecker=beartype)
|
@jaxtyped(typechecker=beartype)
|
||||||
@dataclass
|
@dataclass(frozen=True)
|
||||||
class Camera:
|
class Camera:
|
||||||
"""
|
"""
|
||||||
a description of a camera
|
a description of a camera
|
||||||
@ -61,7 +75,7 @@ class Camera:
|
|||||||
|
|
||||||
|
|
||||||
@jaxtyped(typechecker=beartype)
|
@jaxtyped(typechecker=beartype)
|
||||||
@dataclass
|
@dataclass(frozen=True)
|
||||||
class Detection:
|
class Detection:
|
||||||
"""
|
"""
|
||||||
One detection from a camera
|
One detection from a camera
|
||||||
|
|||||||
348
play.ipynb
348
play.ipynb
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user