2024-10-06 16:23:09 发布
网友
我有一张1000x1350像素的图像。这与实际深度和距离(8844m x 10000m)有关。我已经在图像中绘制了一个500x500米的网格,而这个网格表示一个500x500米的网格,特别是x轴和y轴反映像素的简单比率
我一整天都在讨论这个问题,已经在这里写了一个关于堆栈溢出的糟糕问题,但我相信我找到了正确的问题:
有没有办法给每个像素一个值来代表我的真实距离,同时保持相同的实际像素尺寸
谢谢
使用imshow()中的extent=参数来定义图像的数据坐标
imshow()
extent=
From the docs:
extent : scalars (left, right, bottom, top), optional, default: NoneThe location, in data-coordinates, of the lower-left and upper-right corners. If None, the image is positioned such that the pixel centers fall on zero-based (row, column) indices.
extent : scalars (left, right, bottom, top), optional, default: None
The location, in data-coordinates, of the lower-left and upper-right corners. If None, the image is positioned such that the pixel centers fall on zero-based (row, column) indices.
plt.imshow(img, extent=(0,8844,0,10000)) plt.xlabel('depth (m)') plt.ylabel('distance (m)')
栅格取决于轴的间距。如果需要500x500m的栅格,则必须调整轴间距,然后启用栅格
plt.xticks(np.arange(0,8844,500)); plt.yticks(np.arange(0,10000,500)); plt.grid(True)
使用
imshow()
中的extent=
参数来定义图像的数据坐标From the docs:
栅格取决于轴的间距。如果需要500x500m的栅格,则必须调整轴间距,然后启用栅格
相关问题 更多 >
编程相关推荐