code: def transform(self, translation, theta, method='opencv'):
          
          theta = np.rad2deg(theta)
          trans_map = np.float32(
              [[1, 0, translation[1]], [0, 1, translation[0]]])
          rot_map = cv2.getRotationMatrix2D(
              (self.center[1], self.center[0]), theta, 1)
          trans_map_aff = np.r_[trans_map, [[0, 0, 1]]]
          rot_map_aff = np.r_[rot_map, [[0, 0, 1]]]
          full_map = rot_map_aff.dot(trans_map_aff)
          full_map = full_map[:2, :]
          if method == 'opencv':
              im_data_tf = cv2.warpAffine(
                  self.data, full_map, (self.width, self.height), flags=cv2.INTER_NEAREST)
          else:
              im_data_tf = sni.affine_transform(self.data,
                                                matrix=full_map[:, :2],
                                                offset=full_map[:, 2],
                                                order=0)
          return type(self)(
              im_data_tf.astype(
                  self.data.dtype),
              frame=self._frame)
docs: Create a new image by translating and rotating the current image.
  
          Parameters
          ----------
          translation : :obj:`numpy.ndarray` of float
              The XY translation vector.
          theta : float
              Rotation angle in radians, with positive meaning counter-clockwise.
          method : :obj:`str`
              Method to use for image transformations (opencv or scipy)
  
          Returns
          -------
          :obj:`Image`
              An image of the same type that has been rotated and translated.