I am trying to read and display a tiff image with opencv. I tried different reading modes in imread (-1,0,1,2) The result of the code below displays the image wrongly as blue only while it is colored.
import numpy as np
import cv2
import matplotlib.pyplot as plt
def readImagesAndTimes():
# List of exposure times
times = np.array([ 1/30.0, 0.25, 2.5, 15.0 ], dtype=np.float32)
# List of image filenames
filenames = ["img01.tif", "img02.tif", "img03.tif", "img04.tif", "img05.tif"]
images = []
for filename in filenames:
im = cv2.imread("./data/hdr_images/" + filename, -1)
images.append(im)
return images, times
images, times = readImagesAndTimes()
for im in images:
print(im.shape)
plt.imshow(im, cmap = plt.cm.Spectral)
Original image:
[]
Displayed blue image of the code :
[]