16 lines
632 B
Python
16 lines
632 B
Python
import os
|
|
import cv2
|
|
root_path = "/data1/Hatcher/model/data_MPKFNet/con/FFOutput(1)/"
|
|
result_path = "/data1/Hatcher/model/data_MPKFNet/con/result/"
|
|
if not os.path.exists(result_path):
|
|
os.mkdir(result_path)
|
|
file_list = os.listdir(root_path)
|
|
num = 0
|
|
for file_path in file_list:
|
|
image_list = os.listdir(os.path.join(root_path,file_path))
|
|
for image_path in image_list:
|
|
print(image_path)
|
|
img = cv2.imread(os.path.join(os.path.join(root_path,file_path),image_path))
|
|
Img = img.copy()[20:96, 806:903, :]
|
|
cv2.imwrite(os.path.join(result_path,"{}.jpg".format(str(num).zfill(4))),Img)
|
|
num+=1 |