如何使用特定结构从python中的IR相机加载DAT文件
我尝试读取一个带有以下结构的DAT文件。这是来自IR相机的视频。我尝试了不同的方法,但是一路上总是会出现错误。我想以不同的文件格式将其转换为Python,因此我可以对其进行一些分析。
import csv
datContent = [i.strip().split() for i in open("./Test_s.dat",'rb').readlines()]
# write it as a new CSV file
with open("./Test_s.csv", "wb") as f:
writer = csv.writer(f)
writer.writerows(datContent)
I try to read a dat file with the structure given below. It is a video from an IR camera. I tried different methods, but I always get errors along the way. I would like to convert it in a different file format and load it in python, so I can do some analysis with it.
import csv
datContent = [i.strip().split() for i in open("./Test_s.dat",'rb').readlines()]
# write it as a new CSV file
with open("./Test_s.csv", "wb") as f:
writer = csv.writer(f)
writer.writerows(datContent)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
读取不包括数据日志的标题字段的示例,因为没有提供定义:
我假设Little Endian,将模式中的第一个符号更改为'>'如果DAT文件使用Big Endian。
我希望这足以让您前进,请记住,您需要从某些标头值计算图像数据大小。
我看不到图像计数的标题,因此您可能必须阅读直到文件结束。
Example to read the header fields excluding the data log, since no definition was provided:
I assumed little endian, change the first symbol in the pattern to '>' if the dat file used big endian.
I hope this is enough to get you going, keep in mind you need calculate the image data size from some header values.
I cannot see a header for image count, so you probably have to read until the file ends.