Skip to content

Commit

Permalink
fix camera_model initialization (#264)
Browse files Browse the repository at this point in the history
* fix camera_model initialization

* bump version number
  • Loading branch information
sasha-scale authored Mar 24, 2022
1 parent 9192734 commit 6f6c677
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
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

0 comments on commit 6f6c677

Please sign in to comment.