コード例 #1
0
    def _new(self, center, rotation, intrinsics):
        cam_new = self.VITAL_LIB['vital_camera_new']
        cam_new.argtypes = [
            EigenArray.c_ptr_type(3, 1, ctypes.c_double),
            Rotation.c_ptr_type(ctypes.c_double),
            CameraIntrinsics.c_ptr_type(),
            VitalErrorHandle.c_ptr_type()
        ]
        cam_new.restype = self.c_ptr_type()

        # Fill in parameter gaps
        if center is None:
            center = EigenArray(3)
            center[:] = 0
        else:
            center = EigenArray.from_iterable(center)

        if rotation is None:
            rotation = Rotation()

        if intrinsics is None:
            intrinsics = CameraIntrinsics()

        with VitalErrorHandle() as eh:
            return cam_new(center, rotation, intrinsics, eh)
コード例 #2
0
ファイル: similarity.py プロジェクト: nagyist/kwiver
 def rotation(self):
     """
     Get the rotation of this similarity transformation
     :rtype: Rotation
     """
     rot_ptr = self._call_cfunc(
         'vital_similarity_%s_rotation' % self._tchar, [self.C_TYPE_PTR],
         [self], Rotation.c_ptr_type(self._ctype))
     return Rotation(self._ctype, rot_ptr)
コード例 #3
0
 def rotation(self):
     """
     :return: a copy of this camera's rotation
     :rtype: Rotation
     """
     cam_rot = self.VITAL_LIB['vital_camera_rotation']
     cam_rot.argtypes = [self.c_ptr_type(), VitalErrorHandle.c_ptr_type()]
     cam_rot.restype = Rotation.c_ptr_type()
     with VitalErrorHandle() as eh:
         c_ptr = cam_rot(self, eh)
     return Rotation(from_cptr=c_ptr)
コード例 #4
0
ファイル: camera.py プロジェクト: ALouis38/vital
 def rotation(self):
     """
     :return: a copy of this camera's rotation
     :rtype: Rotation
     """
     cam_rot = self.VITAL_LIB['vital_camera_rotation']
     cam_rot.argtypes = [self.c_ptr_type(), VitalErrorHandle.c_ptr_type()]
     cam_rot.restype = Rotation.c_ptr_type()
     with VitalErrorHandle() as eh:
         c_ptr = cam_rot(self, eh)
     return Rotation(from_cptr=c_ptr)
コード例 #5
0
ファイル: similarity.py プロジェクト: nagyist/kwiver
    def _new(self, s, r, t):
        """
        :type s: float
        :type r: Rotation | None
        :type t: collections.Iterable[float] | None
        """
        # noinspection PyProtectedMember
        if r is None:
            r = Rotation(self._ctype)
        elif r._ctype != self._ctype:
            # Create new Rotation sharing our type
            r = Rotation.from_quaternion(r.quaternion(), self._ctype)

        if t is None:
            t = EigenArray.from_iterable((0, 0, 0), self._ctype)
        else:
            t = EigenArray.from_iterable(t, self._ctype, (3, 1))

        return self._call_cfunc('vital_similarity_%s_new' % self._tchar, [
            self._ctype,
            Rotation.c_ptr_type(self._ctype),
            EigenArray.c_ptr_type(3, 1, self._ctype)
        ], [s, r, t], self.C_TYPE_PTR)
コード例 #6
0
ファイル: camera.py プロジェクト: ALouis38/vital
    def _new(self, center, rotation, intrinsics):
        cam_new = self.VITAL_LIB['vital_camera_new']
        cam_new.argtypes = [EigenArray.c_ptr_type(3, 1, ctypes.c_double),
                            Rotation.c_ptr_type(ctypes.c_double),
                            CameraIntrinsics.c_ptr_type(),
                            VitalErrorHandle.c_ptr_type()]
        cam_new.restype = self.c_ptr_type()

        # Fill in parameter gaps
        if center is None:
            center = EigenArray(3)
            center[:] = 0
        else:
            center = EigenArray.from_iterable(center)

        if rotation is None:
            rotation = Rotation()

        if intrinsics is None:
            intrinsics = CameraIntrinsics()

        with VitalErrorHandle() as eh:
            return cam_new(center, rotation, intrinsics, eh)