[英]How `cv2.imwrite()` to stdout?
I'd like to write an image to stdout. 我想将图像写入stdout。 But I don't find how to make
cv2.imwrite()
support it. 但是我找不到如何使
cv2.imwrite()
支持它。 Is there a way to write the image to stdout? 有没有办法将图像写入stdout?
cv2.imwrite(sys.stdout, x)
TypeError: expected string or Unicode object, file found
cv2.imwrite('/dev/stdout', x)
cv2.error: OpenCV(4.1.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgcodecs/src/loadsave.cpp:662: error: (-2:Unspecified error) could not find a writer for the specified extension in function 'imwrite_'
这样的事情将解决问题。
print cv2.imencode('.jpg', img)[1].tostring()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.