Skip to content

fix camera_model initialization #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to the [Nucleus Python Client](https://github.com/scaleapi/n
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.2](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.8.2) - 2022-03-18

### Added
- a fix to the CameraModels enumeration to fix export of camera calibrations for 3D scenes

## [0.8.1](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.8.0) - 2022-03-18

### Added
Expand Down
6 changes: 3 additions & 3 deletions nucleus/dataset_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
)


class CameraModels(Enum):
class CameraModels(str, Enum):
BROWN_CONRADY = "brown_conrady"
FISHEYE = "fisheye"

Expand Down Expand Up @@ -122,7 +122,7 @@ class CameraParams:

def __post_init__(self):
if self.camera_model is not None:
if self.camera_model not in CameraModels:
if self.camera_model not in (k for k in CameraModels):
raise ValueError(
f'Invalid Camera Model, the supported options are "{CameraModels.BROWN_CONRADY}" and "{CameraModels.FISHEYE}"'
)
Expand All @@ -137,13 +137,13 @@ def from_json(cls, payload: Dict[str, Any]):
payload[FY_KEY],
payload[CX_KEY],
payload[CY_KEY],
payload.get(CAMERA_MODEL_KEY, None),
payload.get(K1_KEY, None),
payload.get(K2_KEY, None),
payload.get(K3_KEY, None),
payload.get(K4_KEY, None),
payload.get(P1_KEY, None),
payload.get(P2_KEY, None),
payload.get(CAMERA_MODEL_KEY, None),
)

def to_payload(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exclude = '''

[tool.poetry]
name = "scale-nucleus"
version = "0.8.1"
version = "0.8.2"
description = "The official Python client library for Nucleus, the Data Platform for AI"
license = "MIT"
authors = ["Scale AI Nucleus Team <nucleusapi@scaleapi.com>"]
Expand Down