img = cv2.imread(root + file)
# img = cv2.imread('256.jpg')
img = cv2.resize(img,(1920,1080))
# cv2.imwrite('1_1960.jpg',img)
img = img.transpose(2, 0, 1) # BGR , to 3x416x416
# img = img[:, :, ::-1].transpose(2, 0, 1) # BGR to RGB, to 3x416x416
img = np.ascontiguousarray(img)
file_object = open(save_path+name+'.bgr', 'wb')
# print(img.dtype)
img = img.astype(np.int8)
print(img.dtype)
file_object.write(img)
file_object.close()
img2bgr
最新推荐文章于 2022-04-14 15:48:36 发布