def test_uint8_to_float_and_back(): img = load_image(get_test_media_filepath(TEST_IMAGE_NAME)) img_float = uint8_to_float(img) img_uint8 = float_to_uint8(img_float) img_diff = img - img_uint8 assert img_diff.max() <= 1
def test_uint8_to_float_and_back(): img = load_image(TEST_IMAGE_PATH) img_float = uint8_to_float(img) img_uint8 = float_to_uint8(img_float) img_diff = img - img_uint8 assert img_diff.max() <= 1
def test_uint8_to_float_and_back_for_video(): vid_data, fps = _load_video(TEST_VIDEO_PATH) vid_float = uint8_to_float(vid_data) vid_unit8 = float_to_uint8(vid_float) vid_diff = vid_data - vid_unit8 play_vid_data(vid_float) assert vid_diff.max() <= 1
def test_uint8_to_float_and_back_for_video(): vid_data, fps = _load_video(get_test_media_filepath(TEST_VIDEO_NAME)) vid_float = uint8_to_float(vid_data) vid_unit8 = float_to_uint8(vid_float) vid_diff = vid_data - vid_unit8 if DISPLAY_RESULTS: play_vid_data(vid_float) assert vid_diff.max() <= 1 del vid_float
def load_image(img_path): img_path = str(img_path) img = cv2.imread(img_path) return uint8_to_float(img)
def load_video_float(video_filename): vid_data, fps = _load_video(video_filename) return uint8_to_float(vid_data), fps
def load_video_float(video_filename): vid_data, fps = _load_video(video_filename) vid_dtf = uint8_to_float(vid_data) #print(vid_dt) return vid_dtf, fps