Skip to content

Commit

Permalink
build: lower matplotlib version
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisochoatri committed Jun 11, 2024
1 parent 78f8990 commit b302798
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ botocore
Click>=7.1.2
diskcache>=4.1.0
protobuf>=3.20.1,<4.0.0
matplotlib>=3.0.3,<4.0
matplotlib>=3.0.3,<3.9.0
opencv-python>=4.5.3.56
Pillow-SIMD>=8.3.2
pycocotools>=2.0.0
Expand Down
25 changes: 25 additions & 0 deletions tests/test_camera_transforms.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright 2021-2022 Woven Planet. All rights reserved.
import os
import unittest
from typing import OrderedDict

import cv2
import numpy as np
import PIL

from dgp.annotations.camera_transforms import (
AffineCameraTransform,
Expand All @@ -18,6 +20,7 @@
from dgp.annotations.ontology import KeyLineOntology, KeyPointOntology
from dgp.datasets.synchronized_dataset import SynchronizedSceneDataset
from dgp.proto.ontology_pb2 import Ontology as OntologyV2Pb2
from dgp.utils.pose import Pose
from dgp.utils.structures.key_line_2d import KeyLine2D
from dgp.utils.structures.key_point_2d import KeyPoint2D
from dgp.utils.visualization_utils import visualize_cameras
Expand Down Expand Up @@ -428,6 +431,28 @@ def test_crop_scale_transform(self):

assert_almost_equal(cam_datum, cam_datum3, valid_region=valid_region)

def test_crop_scale_transform_simple(self):
"""Simple test case for crop scale transform"""

datum = OrderedDict({
'datum_name': 'test',
'datum_type': 'image',
'pose': Pose(),
'extrinsics': Pose(),
'intrinsics': np.array([
[1976.45, 0, 2692 / 2],
[0, 1977.05, 1836 / 2],
[0, 0, 1.0],
]),
'rgb': PIL.Image.new('RGB', (2692, 1836)),
})

target_shape = (544, 960)
tr = CropScaleTransform(target_shape=target_shape, fix_h=False)
datum2 = tr(datum)
assert np.isclose(datum2['intrinsics'][0, 0], 704.82, atol=1e-3)
assert np.isclose(datum2['intrinsics'][1, 1], 705.04, atol=1e-3)

def test_composite_transform(self):
"""Test that we can compose transforms correctly. We test that we can get the
same datum by applying multiple transformation consecutively vs all at once.
Expand Down

0 comments on commit b302798

Please sign in to comment.