title: How to use opencv in Python3 to read file from file buffer
body: <p>I am trying to use <a href="https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html" rel="nofollow noreferrer">this</a> library. In particular these 3 lines: </p>
  
  <pre><code>    image_stream = io.BytesIO(image_bytes)
      frame = cv2.imread(image_stream)
  </code></pre>
  
  <p>and I am having an exception:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/a/Pictures/pycharm-community-2018.3.2/helpers/pydev/pydevd.py", line 1741, in &lt;module&gt;
      main()
    File "/home/a/Pictures/pycharm-community-2018.3.2/helpers/pydev/pydevd.py", line 1735, in main
      globals = debugger.run(setup['file'], None, None, is_module)
    File "/home/a/Pictures/pycharm-community-2018.3.2/helpers/pydev/pydevd.py", line 1135, in run
      pydev_imports.execfile(file, globals, locals)  # execute the script
    File "/home/a/Pictures/pycharm-community-2018.3.2/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
      exec(compile(contents+"\n", file, 'exec'), glob, loc)
    File "/home/a/Documents/wiker/main.py", line 13, in &lt;module&gt;
      if __name__ == '__main__': main()
    File "/home/a/Documents/wiker/main.py", line 10, in main
      article['video'] = video.make_video_from_article(article)
    File "/home/a/Documents/wiker/video.py", line 15, in make_video_from_article
      frame = cv2.imread(image_stream)
  TypeError: bad argument type for built-in operation
  </code></pre>
  
  <p>But it works on real files. what can be fixed here.</p>