def __init__(self, dst_shape, focal_len=350): self._generator = FishEyeGenerator(focal_len, dst_shape) self._F_RAND_FLAG = False self._F_RANGE = [200, 400] self._EXT_RAND_FLAG = False self._EXT_PARAM_RANGE = [5, 5, 10, 0.3, 0.3, 0.4] self._generator.set_ext_param_range(self._EXT_PARAM_RANGE)
def __init__(self, focal_len, shape=None): self._transformer = FishEyeGenerator(focal_len, shape) self._F_RAND_FLAG = False self._F_RANGE = [200, 400] self._EXT_RAND_FLAG = False self._EXT_PARAM_RANGE = [0, 0, 0, 0, 0, 0] self._transformer.set_ext_param_range(self._EXT_PARAM_RANGE) self._RAND_CROP = False self._rand_crop_rate = 0.8 self._NORMAL_SCALE = False self._scale_range = [0.5, 2] self._FISH_SCALE = False self._fish_scale_range = [0.5, 2] self._NORMAL_TRANSLATE = False self._trans_range = [-20, 20]
def test_trans(): trans = FishEyeGenerator(400, [640, 640]) img = cv2.imread("images/1train.png") im_annot = cv2.imread("images/1annot.png", 0) # trans.set_f(300) trans.set_ext_params([0, 0, 0, 0, 0, 0]) # trans.rand_ext_params() # s = time.time() image = trans.transFromColor(img) label_dst = trans.transFromGray(im_annot, reuse=True) label = label2color(label_dst) # print("Time cost:", e-s) # image = cv2.resize(dst, None, fx=0.5,fy=0.5,interpolation=cv2.INTER_CUBIC) # label = cv2.resize(label, None, fx=0.5,fy=0.5,interpolation=cv2.INTER_NEAREST) cv2.imshow("src0", image) cv2.imshow("dst0", label) cv2.waitKey(0)