直接存储校正后的图像老是报错!!
from PIL import Image
# 使用remap函数完成映射
Left_rectified = cv2.remap(frameL, Left_Stereo_Map[0], Left_Stereo_Map[1],
cv2.INTER_LANCZOS4, cv2.BORDER_CONSTANT, 0)
im_L = Image.fromarray(Left_rectified) # numpy 转 image类
imgr.save('../processimages/rectified_imgr.jpg')
后来发现图像格式是narray类型,要转化为image类,可以存储
但是这样转化为image类时,后面计算视差图时,又会有各种报错。
后来发现这样转换存储就可以了。。。
imgl = Image.fromarray(iml_rectified) # numpy 转 image类
imgr = Image.fromarray(imr_rectified) # numpy 转 image类
imgl = np.array(imgl, dtype=np.uint8)
imgr = np.array(imgr, dtype=np.uint8)
cv2.imwrite('../processimages/rectified_imgl.jpg',imgl)
cv2.imwrite('../processimages/rectified_imgl.jpg', imgr)