CycleGAN训练~训练图像进行拼接

 

import os
import cv2
import numpy as np
Adir = './trainA/'
Bdir = './trainB/'
ABdir = './datasets/train/'

num=0
for fi in os.listdir(Adir):
        im_A = cv2.imread(Adir+fi) # python2: cv2.CV_LOAD_IMAGE_COLOR; python3: cv2.IMREAD_COLOR
        im_B = cv2.imread(Bdir+'0'+fi[1:]) # python2: cv2.CV_LOAD_IMAGE_COLOR; python3: cv2.IMREAD_COLOR
        im_AB = np.concatenate([im_A, im_B], 1)
        cv2.imwrite(ABdir+str(num)+'.jpg', im_AB)
        num = num + 1
        print (num)

  

posted @ 2021-03-31 13:13  皮卡皮卡妞  阅读(107)  评论(0编辑  收藏  举报