【发布时间】:2015-08-06 20:39:56
【问题描述】:
我有大约 100,000 张 tiff 图像的时间序列,我想在 excel 表或 txt 文件中获取时间戳。我在python中使用了以下代码来获取图像元数据
import exifread
f = open(photopath)
tags = exifread.process_file(f)
当我这样做时,我得到了很多元数据,但没有时间戳。这是我得到的输出
{'Image BitsPerSample': (0x0102) Short=16 @ 417654,
'Image Compression': (0x0103) Short=Uncompressed @ 417666,
'Image ImageDescription': (0x010E) ASCII=Created by Hamamats, ... ] @ 417830,
'Image ImageLength': (0x0101) Short=348 @ 417642,
'Image ImageWidth': (0x0100) Short=600 @ 417630,
'Image Orientation': (0x0112) Short=Horizontal (normal) @ 417714,
'Image PageNumber': (0x0129) Short=[0, 0] @ 417786,
'Image PhotometricInterpretation': (0x0106) Short=1 @ 417678,
'Image PlanarConfiguration': (0x011C) Short=1 @ 417762,
'Image ResolutionUnit': (0x0128) Short=Pixels/Inch @ 417774,
'Image RowsPerStrip': (0x0116) Short=348 @ 417738,
'Image SampleFormat': (0x0153) Short=Unsigned @ 417798,
'Image SamplesPerPixel': (0x0115) Short=1 @ 417726,
'Image StripByteCounts': (0x0117) Long=417600 @ 417750,
'Image StripOffsets': (0x0111) Long=8 @ 417702,
'Image SubfileType': (0x00FE) Long=Single page of multi-page image @ 417618,
'Image Tag 0xFFFB': (0xFFFB) Byte=16 @ 417810,
'Image Tag 0xFFFC': (0xFFFC) Long=[1, 4294967295L] @ 418368}
当我在 ImageJ 中打开文件时,我可以看到时间戳。但我一次只能看到一张图片。有没有办法在python中查看时间戳? exifread 是否有可能在 tiff 文件头中为时间戳寻找错误的关键字?
谢谢 萨拉
【问题讨论】:
-
您是否尝试将调试参数设置为 process_file?
-
您是否在 ImageJ 图像属性中找到时间戳?标签的名称是什么?还是操作系统中文件的时间戳?
-
如果这些是 TIFF 文件中的唯一标签,则没有时间戳。你知道最后两个私有标签包含什么吗?另外,您为什么不在这些图像上使用 LZW 或 Flate 之类的无损压缩?可能会将它们缩小 2 到 5 倍。
-
在 Image J 中,我在 Image >> Show Info 下查看。并且标签有 Time_from_start 和 Time_from_last
-
这里是 google drive 文件夹的链接,该文件夹有一个 zip 文件,其中包含一些 tiff 文件,以防有人想尝试获取时间戳。 drive.google.com/a/usc.edu/file/d/0B-UUDROd7kxJdzZ6TmlPT0hVbzQ/…
标签: python-2.7 timestamp tiff exif imagej