我有一个深度图像16单位一个人的手,在阈值后。我想恢复一些几何特征,如轮廓、凸壳等,但所有这些函数都能处理8位或32位图像,所以我需要转换。我在用python工作!在
我试过用一些开放的cv函数
img32 = np.array(thresh, dtype=np.float32) # This line only change the type, not values
img32 *= 65536 # Now we get the good values in 32 bit format
print img.dtype
但我的形象一直是16英寸。在
我不相信PNG支持浮点数据,所以我不确定您希望输出的格式是什么?在
如果原始的32位float RGB没问题,您可以使用ImageMagick,它安装在大多数Linux发行版上,并且很容易在osx和Windows上使用。命令应该是
例如,如果您创建这样的1x1白色图像
^{pr2}$你会得到这样一个12字节的图像
如果你创建一个这样的1x1黑色图像
你会得到这样一个12字节的图像
相关问题 更多 >
编程相关推荐