我有一大堆50K图像保存为3 * 1024阵列(RGB 32X32),我想将它们转换为cv2格式。
# Here I read the images
def unpickle(file):
import cPickle
with open(file, 'rb') as fo:
dict = cPickle.load(fo)
return dict
def my_main():
print 'unpicking training set images'
d = unpickle(pickled_training_files)
print 'reshaping the images to 5 sets of 10,000 images (RGB - 3*32*32)'
training_set_images = d.itervalues().next().reshape((5,10000,3,32,32))
print 'loading image with opencv'
tmp_img = training_set_images[0][0]
print tmp_img.dtype # result is uint8
my_main()
我该怎么办?我尝试了所有我在这里看过的东西,但没有任何帮助
特别是,我现在尝试的是使用cv2_img = cv2.imdecode(tmp_img, )
中的第二个参数,但结果始终为None