我正在尝试使用Vispy将我的视觉图像转换成极坐标形式。
类似于下面的图片..。
使用下面的Vispy代码生成的原始图像
scene.visuals.Image(self.img_data,interpolation=interpolation,parent = self.viewbox.scene, cmap=self.cmap, method='subdivide', clim=(-65,40))

所需极坐标图像:

我确实尝试过使用polarTransform实现来自Vispy的PolarTransform示例,但没有成功。
请任何人指导我如何做以上图像的polarTransform到极地使用Vispy。
谢谢
回复@djhoese:图像由Vispy在PolarTransform之前生成

图像在PolarTransform后由Vispy生成

PolarTransform代码:
self.img.transform = PolarTransform()发布于 2021-07-15 08:35:54
ImageVisual和PolarTransform在一起打得不太好。
VisPy有两种绘图方法,subdivide和impostor。我将在这里集中讨论subdivide。这将不适用于impostor。
首先,像这样创建ImageVisual:
img = visuals.ImageVisual(image,
grid=(1, N),
method='subdivide')对于N使用一个合理的高数字(如360)。使用这个数字,您将立即看到极地分辨率如何受到影响。
此外,还需要设置一些特定的转换链:
transform = (
# move to final location and scale to your liking
STTransform(scale=(scx,scy), translate=(xoff,yoff))
# 0
# just plain simple polar transform
*PolarTransform()
# 1
# pre scale image to work with polar transform
# PolarTransform does not work without this
# scale vertex coordinates to 2*pi
* STTransform(scale=(2 * np.pi / img.size[0], 1.0))
# 2
# origin switch via translate.y, fix translate.x
* STTransform(translate=(img.size[0] * (ori0 % 2) * 0.5,
-img.size[1] * (ori0 % 2)))
# 3
# location change via translate.x
* STTransform(translate=(img.size[0] * (-loc0 - 0.25), 0.0))
# 4
# direction switch via inverting scale.x
* STTransform(scale=(-dir0, 1.0))
)
# set transform
img.transform = transformdir0 -方向cw/ccw (取值-1/1 )loc0 -零的位置(值在0到2* np.pi之间,逆时针方向)ori0端( top或bottom的值为0,1)。下面的四个STTransform当然可以简化。它们被分割开来,以显示不同的更改以及它们必须如何应用。
稍后将向VisPy示例部分添加一个示例。
https://stackoverflow.com/questions/68177737
复制相似问题