Spaces:
Build error
Build error
File size: 1,424 Bytes
d7a991a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from mmcv.utils import Registry
CAMERAS = Registry('camera')
class SingleCameraBase(metaclass=ABCMeta):
"""Base class for single camera model.
Args:
param (dict): Camera parameters
Methods:
world_to_camera: Project points from world coordinates to camera
coordinates
camera_to_world: Project points from camera coordinates to world
coordinates
camera_to_pixel: Project points from camera coordinates to pixel
coordinates
world_to_pixel: Project points from world coordinates to pixel
coordinates
"""
@abstractmethod
def __init__(self, param):
"""Load camera parameters and check validity."""
def world_to_camera(self, X):
"""Project points from world coordinates to camera coordinates."""
raise NotImplementedError
def camera_to_world(self, X):
"""Project points from camera coordinates to world coordinates."""
raise NotImplementedError
def camera_to_pixel(self, X):
"""Project points from camera coordinates to pixel coordinates."""
raise NotImplementedError
def world_to_pixel(self, X):
"""Project points from world coordinates to pixel coordinates."""
_X = self.world_to_camera(X)
return self.camera_to_pixel(_X)
|