问题描述
我们如何在python中读取16个uint jpeg图像请向我建议可以在python中读取这些类型文件的库.我尝试了matplotlib,scipy,scikit-image,medpy,Pil,opencv,numpy库.当我们使用这些库时,我的输出结果为:
How we can read the 16 uint jpeg images in python please suggest me the libraries which can read the these type of files in python.i tried matplotlib, scipy, scikit-image, medpy ,Pil ,opencv, numpy libraries. when we are using these libraries i am getting the out put as:
raise IOError("cannot identify image file")
IOError: cannot identify image file
请帮助我
从链接中找到文件
https://drive.google.com/file/d/0B4l5GiM7kBXraDEyMXdseENfUlE/edit?usp = sharing
推荐答案
具有16位JPEG图像听起来有些奇怪,因为JPEG标准不支持16位图像.不过,它具有12位图像.不幸的是,大多数阅读器仅支持普通的8位/像素RGB图像,因此即使使用12位图像,这也可能有些挑战.
Having 16-bit JPEG images sounds a bit strange, as the JPEG standard does not support 16-bit images. It has 12-bit images, though. Unfortunately, most readers only support the usual 8-bits/pixel RGB images, so even with the 12-bit images this may be a bit challenging.
一个有用的测试可以尝试:
One useful test could be to try:
hdr = open("myimage.jpeg", "rb").read(2)
print "{:02x} {:02x}".format(ord(hdr[0]), ord(hdr[1]))
如果您的文件是JPEG文件,则应以以下开头:
If your file is a JPEG file, it should start with:
ff d8
如果您没有得到这些文件,那么该文件就是其他文件.有什么程序可以用来打开文件?哪个程序生成文件?
If you do not get those, then the file is something else. Is there any program you can use to open the file? Which program produced the files?
这篇关于我们如何在python中读取16个无符号整数(16 uint)jpeg文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!