我正在使用PyOpenCV。如何将cv2图像(numpy)转换为二进制字符串以写入MySQL数据库,而不需要临时文件和imwrite
?
我搜索了一下,但是没有找到...
我尝试使用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
帮助别人!
cv2.imdecode(nparr, cv2.IMREAD_COLOR)
进行解码。 - ichbinblau