file = request.files['file']
img = file.read()
img = cv2.imdecode(np.frombuffer(img, np.uint8), cv2.IMREAD_COLOR)
请注意如果这里用
cv2.imread()
则会报错
SystemError: <built-in function imread> returned NULL without setting an error
参考https://www.jianshu.com/p/cafbeec49674