【发布时间】:2013-07-31 19:09:00
【问题描述】:
我正在使用 PyOpenCV。如何将 cv2 图像(numpy)转换为二进制字符串,以便在没有临时文件和imwrite 的情况下写入 MySQL db?
我用谷歌搜索了它,但什么也没找到......
我正在尝试imencode,但它不起作用。
capture = cv2.VideoCapture(url.path)
capture.set(cv2.cv.CV_CAP_PROP_POS_MSEC, float(url.query))
self.wfile.write(cv2.imencode('png', capture.read()))
错误:
File "server.py", line 16, in do_GET
self.wfile.write(cv2.imencode('png', capture.read()))
TypeError: img is not a numerical tuple
帮助别人!
【问题讨论】:
标签: python image opencv binary