简体   繁体   中英

python opencv imread intermittently returns None on macOS

Even though the (TIFF) file definitely exists (whether the path is relative or absolute), cv2.imread is (sometimes) returning None on macOS:

image = cv2.imread(filename)

opencv is at version 2.4.13.2.

The filenames contain . and _ .

It's the intermittent behaviour that is puzzling me.

Any ideas? Thanks!

For me installation of opencv-python package from pypi helped.

In my case it was within conda environment with python 3.7. So generally steps were:

  1. activating env: conda activate my-env
  2. call pip install opencv-python : install package in addition to main opencv conda packages: opencv , libopencv , py-opencv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM