2

I am using the opencv with following config:

opencv-python == 3.4.3
python version --> 3.6
os --> Windows 10

I am trying to read a TIFF image using cv2.imread() function but am getting "None" as response. Below is the code I am trying with:

import cv2
img = cv2.imread('abc.tif', cv2.IMREAD_UNCHANGED)
print(img)

The result of this script is None.

I have verified that the given image is available at the required path. The same code works when I try to read a PNG file. I am guessing the problem is with TIFF format. Also, it used to work well with Python 2.7. I recently upgraded to Python 3.6 and since then am having this problem.

Community
  • 1
  • 1
Anoop Sharma
  • 87
  • 1
  • 13
  • 1
    Can you share the image please? – Mark Setchell Nov 13 '18 at 20:42
  • What do you mean by read ? Display/show it ? – lucians Nov 13 '18 at 21:26
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Nov 13 '18 at 23:18
  • @MarkSetchell I am unable to upload the image here. It says the format is not supported. I am using a .tif image. – Anoop Sharma Nov 14 '18 at 12:23
  • @Link By read, I mean, read the image as an array of pixels. – Anoop Sharma Nov 14 '18 at 12:24
  • I feel this link (https://stackoverflow.com/questions/18446804/python-read-and-write-tiff-16-bit-three-channel-colour-images/18461475) might be helpful – Sundaresh Nov 27 '18 at 17:52

1 Answers1

0

I also had this issue in opencv-python 3.4.3.

According to the maintainer of opencv-python, it was an opencv issue, not an opencv-python issue https://github.com/skvark/opencv-python/issues/130. However, the issue seems to be resolved in opencv-python 3.4.5.

So the solution is to upgrade opencv-python.

Joe Carey
  • 76
  • 3