python包将图像从灰度转换为假彩色并返回
colorscale的Python项目详细描述
python包colorscale
这个包是为了便于处理“假颜色”。许多 科学领域使用图像文件实现二维可视化 标量数据。然后,原始数据可以表示为灰度图像。 出于不同的原因,用错误的颜色表示这些数据可以是 有用。此包帮助将灰度图像转换为“false” 另一方面,通常希望能够访问 到假彩色图的原始值。如果色阶(或 “彩色地图”)是已知的,它是双射的(可逆的一对一)。 映射),可以从错误的 使用这个工具给图像上色。
安装
pip install colorscale
用法
安装后,将提供两个命令行工具:
- to_color_scale和
- to_gray_scale。
使用--help标记启动它们,以了解如何使用它们:
$ to_color_scale --help usage: to_color_scale [-h] -s {tillscale} [-b {pil,cv2}] IMAGEFILE Convert an image saved as false color to grayscale positional arguments: IMAGEFILE The image to convert optional arguments: -h, --help show this help message and exit -s {tillscale}, --colorscale {tillscale} Desired color scale -b {pil,cv2}, --backend {pil,cv2}
以及
$ to_gray_scale --help usage: to_gray_scale [-h] -s COLORSCALE IMAGEFILE Convert an image saved as false color to grayscale positional arguments: IMAGEFILE The image to convert optional arguments: -h, --help show this help message and exit -s COLORSCALE, --colorscale COLORSCALE {tillscale} Desired color scale