我正在使用open-cv python对图像进行补充,而在写入图像时,open-cv并未在补充图像中写入 header 信息。我的图像数据为TIFF格式。
我正在这样...
import cv2
img = cv2.imread("image.tiff", -1)
for i in xrange(0, len(img)):
for j in xrange(0, len(i)):
img[i][j] = 65535-img[i][j]
cv2.imwrite("complemented.tif", img)
最佳答案
如该link,Each TIFF file begins with a image file header which points to one or more image file directories, which contain the image data and image information.
中所述,多图像TIFF需要 header 信息。
多图像TIFF在OpenCV中是not supported,如注释中提到的@Haris。
由于不支持多图像TIFF,因此很可能不会使用imread
读取 header 信息,因此无法使用imwrite
写入 header 信息。
关于python - 使用opencv写入后,图像中的标题信息丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21599464/