python - 使用 scikit-image 在反向时钟方向上对图像执行极坐标变换
问题描述
如以下实验所示,scikit-imagewarp_polar
库的函数执行时钟方向的极坐标变换。但是,我想在反向时钟方向上执行极坐标变换。我可能应该以某种方式翻转或旋转图像以获得所需的最终结果。但是,我不知道该怎么做。我将不胜感激任何有效的解决方案。
在正确的解决方案中,转换后的图像将具有以下数字序列:3、2、1、12、11、10...。
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import matplotlib.gridspec as gridspec
from skimage.transform import warp_polar
import cv2
testImg = cv2.cvtColor(mpimg.imread('clock.png'), cv2.COLOR_BGR2GRAY)
pol = warp_polar(testImg, radius=min(testImg.shape)/2)
# Create 2x2 sub plots
gs = gridspec.GridSpec(1, 2)
fig = plt.figure()
ax1 = fig.add_subplot(gs[0, 0]) # row 0, col 0
ax1.imshow(testImg)
ax1.set_title("Original Image")
ax2 = fig.add_subplot(gs[0, 1]) # row 0, col 1
ax2.imshow(pol)
ax2.set_title("Polar Transformation")
plt.show()
解决方案
推荐阅读
- firebase - Firebase 自定义声明未在规则中更新
- embedded - 抢占式 RTOS 内核中的 WDT
- javascript - 尝试将 POST 请求从前端正确传递到 java servlet 后端
- php - 如何使用 Google Language API 在使用 PHP 语言的网站中添加多语言?
- typescript - 如何声明导入另一个类型的 TypeScript 模块
- javascript - 如何找到 typedArray 的类型?
- sharepoint - SharePoint Online 图表
- python - 一定范围内的散点图 - python
- android - 如何创建始终在片段侧面可见的导航视图?
- ios - 我应该有注册/登录流程以在 tvOS 应用程序中实现应用程序内购买吗?