目录
1 使用OpenCV生成
首先,将原始图片test.jpg改变为指定的尺寸,例如336*336*3。
然后,存成raw数据test.raw。
代码如下:
import cv2
import numpy as np
def create_image_cv(input_path):
img_path = input_path + ".jpg"
img = cv2.imread(img_path)
print('Original Dimensions : ', img.shape)
resized = cv2.resize(img, (336, 336), interpolation=cv2.INTER_AREA)
print('resized Dimensions : ', resized.shape)
cv2.imwrite(img_pa