affinetransform掠夺而不切断边缘
我正在尝试使用 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?
Cutted edges after script above:
Kind regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将
output_shape =
参数提供给warp
,并确保它足够大以包含您的转换图像。要进行一般(对于仿射变换),您需要转换图像的所有四个角,并为每个轴占据最大值。您还需要确保整个图像在正坐标空间中,因为无法显示具有负坐标的象限。You need to provide the
output_shape=
argument towarp
, 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.