【发布时间】:2016-06-25 15:57:17
【问题描述】:
我在我的烧瓶应用程序中使用 opencv(python 2.7) 通过网络摄像头捕获图像。我想将此图像显示给前端的客户端以获取鼠标单击时图像的坐标。如何编写发送和发送的函数分别通过flask和javascript接收图像。
烧瓶服务器代码:
from flask import Flask,render_template
import cv2
app = Flask(__name__)
@app.route('/')
def capture_image(self):
self.cam = cv2.VideoCapture(0)
self.img = self.cam.read()
self.cam.release()
render_template(index.html,ob=self.img)
@app.route('/index')
#display image in html
if __name__=='__main__':
app.run()
javascript代码:
<html>
<head>
<title> image </title>
</head>
<body>
<img src = "{{ url_for('imagefield') }}">
</body>
</html>
【问题讨论】:
标签: javascript opencv canvas flask