示例#1
0
            torch.save(state, './checkpoint/autoencoder.t7')
            test_A_ = target_A[0:14]
            test_B_ = target_B[0:14]
            test_A = var_to_np(target_A[0:14])
            test_B = var_to_np(target_B[0:14])
            figure_A = np.stack([
                test_A,
                var_to_np(model(test_A_, 'A')),
                var_to_np(model(test_A_, 'B')),
            ], axis=1)
            figure_B = np.stack([
                test_B,
                var_to_np(model(test_B_, 'B')),
                var_to_np(model(test_B_, 'A')),
            ], axis=1)

            figure = np.concatenate([figure_A, figure_B], axis=0)
            figure = figure.transpose((0, 1, 3, 4, 2))
            figure = figure.reshape((4, 7) + figure.shape[1:])
            figure = stack_images(figure)

            figure = np.clip(figure * 255, 0, 255).astype('uint8')

            # cv2.imshow("", figure)
            cv2.imwrite("./data/"+str(nums)+'.jpg', figure)
            # key = cv2.waitKey(1)
            # if key == ord('q'):
            #     exit()


示例#2
0
from pylsci import Lsci
from util import stack_images, show_image, read_image

lsci = Lsci()

print('temporal LSCI ...')
speckle_imgs = read_image('img/temporal.png')
speckle_img_stack = stack_images(speckle_imgs)
print(speckle_img_stack.shape)
t_lsci = lsci.temporal_contrast(speckle_img_stack)
show_image(t_lsci)
print(t_lsci.shape)

print('spatio-temporal LSCI ...')
speckle_imgs = read_image('img/temporal.png')
speckle_img_stack = stack_images(speckle_imgs)
print(speckle_img_stack.shape)
st_lsci = lsci.spatio_temporal_contrast(speckle_img_stack)
show_image(st_lsci)
print(st_lsci.shape)

print('spatial LSCI ...')
speckle_img = read_image('img/spatial.tif')
print(speckle_img.shape)
s_lsci = lsci.spatial_contrast(speckle_img)
show_image(s_lsci)
print(s_lsci.shape)

print('success')