可以通过图像和个体点在极坐标和笛卡尔域之间转换的库。
polarTransform的Python项目详细描述
简介
polarttransform是一个python包,用于在极坐标域和笛卡尔域之间转换图像。它包含许多 指定开始/停止半径和角度、插值顺序(双三次、线性、最近等)和 更多。
安装
先决条件
- Python3
-
依赖关系:
- 努比
- scipy
- SCIKIT图像
安装PolarTransform
polarttransform当前在PyPi上可用。最简单的方法 单独安装在命令行使用pip:
pip install polarTransform
安装最新版本。从存储库中安装最新的代码(通常是稳定的,但可能有 未记录的更改或错误):
pip install git+https://github.com/addisonElliott/polarTransform.git
对于开发人员,可以克隆polarttransform存储库并运行setup.py文件。使用以下命令获取 从github复制并安装所有依赖项:
git clone pip install git+https://github.com/addisonElliott/polarTransform.git cd polarTransform pip install .
或者,对于最后一行,请使用:
pip install -e .
要以“开发”或“可编辑”模式安装,可以对本地工作代码进行更改,python将使用 更新的polartTransform代码。
测试和覆盖范围
在基本目录中运行以下命令以运行测试:
python -m unittest discover -v polarTransform/tests
示例
输入图像:
importpolarTransformimportmatplotlib.pyplotaspltimportimageioverticalLinesImage=imageio.imread('IMAGE_PATH_HERE')polarImage,ptSettings=polarTransform.convertToPolarImage(verticalLinesImage,initialRadius=30,finalRadius=100,initialAngle=2/4*np.pi,finalAngle=5/4*np.pi)cartesianImage=ptSettings.convertToCartesianImage(polarImage)plt.figure()plt.imshow(polarImage,origin='lower')plt.figure()plt.imshow(cartesianImage,origin='lower')
结果是具有指定的初始和最终半径和角度的极坐标域图像:
转换回笛卡尔图像只会显示原始图像的一部分,因为指定了初始和最终半径和角度:
下一步
要了解更多关于polarttransform的信息,请参见documentation。
许可证
polarttransform有一个基于mit的license。