diff --git a/samples/SampleProcessor.py b/samples/SampleProcessor.py index 9e5a0b3..b9b96fc 100644 --- a/samples/SampleProcessor.py +++ b/samples/SampleProcessor.py @@ -167,9 +167,9 @@ class SampleProcessor(object): if is_face_sample and target_face_type != -1: if target_face_type > sample.face_type: raise Exception ('sample %s type %s does not match model requirement %s. Consider extract necessary type of faces.' % (sample.filename, sample.face_type, target_face_type) ) - img = cv2.warpAffine( img, LandmarksProcessor.get_transform_mat (sample.landmarks, size, target_face_type), (size,size), flags=cv2.INTER_LANCZOS4 ) + img = cv2.warpAffine( img, LandmarksProcessor.get_transform_mat (sample.landmarks, size, target_face_type), (size,size), flags=cv2.INTER_CUBIC ) else: - img = cv2.resize( img, (size,size), cv2.INTER_LANCZOS4 ) + img = cv2.resize( img, (size,size), cv2.INTER_CUBIC ) if random_sub_size != 0: sub_size = size - random_sub_size diff --git a/utils/image_utils.py b/utils/image_utils.py index 877d176..21f9250 100644 --- a/utils/image_utils.py +++ b/utils/image_utils.py @@ -262,9 +262,9 @@ def gen_warp_params (source, flip, rotation_range=[-10,10], scale_range=[-0.5, 0 def warp_by_params (params, img, warp, transform, flip, is_border_replicate): if warp: - img = cv2.remap(img, params['mapx'], params['mapy'], cv2.INTER_LANCZOS4 ) + img = cv2.remap(img, params['mapx'], params['mapy'], cv2.INTER_CUBIC ) if transform: - img = cv2.warpAffine( img, params['rmat'], (params['w'], params['w']), borderMode=(cv2.BORDER_REPLICATE if is_border_replicate else cv2.BORDER_CONSTANT), flags=cv2.INTER_LANCZOS4 ) + img = cv2.warpAffine( img, params['rmat'], (params['w'], params['w']), borderMode=(cv2.BORDER_REPLICATE if is_border_replicate else cv2.BORDER_CONSTANT), flags=cv2.INTER_CUBIC ) if flip and params['flip']: img = img[:,::-1,:] return img