affinetransform掠夺而不切断边缘

发布于 2025-01-20 18:18:36 字数 578 浏览 1 评论 0原文

我正在尝试使用 Skimage 转换图像,该图像已旋转且有点倾斜。

image = io.imread("id_1.jpg")
afine_tf = tf.AffineTransform(shear=0.3, rotation=-0.5)
modified = tf.warp(image, inverse_map=afine_tf)
io.imshow(modified)
io.show()

但每次我这样做时,边缘都会被切断,是否有可能在不切断边缘的情况下变换图像?

原来的: 输入图片此处描述

上面脚本后的切边: 输入图片此处描述

亲切的问候

i am trying to transform image, that is rotated and a little skewed with Skimage.

image = io.imread("id_1.jpg")
afine_tf = tf.AffineTransform(shear=0.3, rotation=-0.5)
modified = tf.warp(image, inverse_map=afine_tf)
io.imshow(modified)
io.show()

but every time I do this, the edges are cut off, is there a possibility to transform the image without cutting edges?

Original:
enter image description here

Cutted edges after script above:
enter image description here

Kind regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相守太难 2025-01-27 18:18:36

您需要将output_shape =参数提供给warp,并确保它足够大以包含您的转换图像。要进行一般(对于仿射变换),您需要转换图像的所有四个角,并为每个轴占据最大值。您还需要确保整个图像在正坐标空间中,因为无法显示具有负坐标的象限。

You need to provide the output_shape= argument to warp, and make sure it is big enough to contain your transformed image. To do this generically (for affine transforms) you need to transform all four corners of the image, and take the maximum value for each axis. You also need to make sure the whole image is in the positive coordinate space, as there is no way to display quadrants with negative coordinates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文