问题描述
我制作了一个用于面部识别的小型python应用程序,现在将其转换为flask应用程序。
@app.route('/save',methods=['POST'])
def save_image():
if request.method == 'POST':
if 'imageFile' not in request.files:
return {"detail": "No file found"},400
image = request.files['imageFile']
imageFileName = secure_filename(image.filename)
image.save('./images/' + imageFileName)
image = cv2.imread('./images/' + imageFileName)
image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
face_encoding = face_recognition.face_encodings(image)[0]
np.savetxt('./encodings/' + request.form['indexnumber'] + '.csv',face_encoding,delimiter=',')
return 'saving image'
在上面的代码中,我保存了发布到服务器的图像,并使用cv2.imread再次读取了图像,之后又使用它来创建人脸编码。我要执行的操作是不将图像保存在服务器中。是否可以直接阅读上面发布的图像并像上面一样使用?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)