在Python中是否有一个等价于matlab的imtransform函数?

2024-04-18 19:22:46 发布

您现在位置:Python中文网/ 问答频道 /正文

The documentation

我正在尝试将一些matlab代码转换成Python。我不确定它是做什么的,但是如果我理解正确的话,它会将一个图像转换成另一个图像,图像中的像素是参数。在

在PIL,numpy,哪一个库中,有没有与python相同的东西?我想这一定是一个复杂的方法,所以atm机我不希望自己能做到。在


Tags: the方法代码图像numpy参数pildocumentation
2条回答

您可以检查^{}。可能不存在与imtransform完全等价的函数。但是一般的转换功能确实存在。在

Python Image Library有一个接受矩阵的变换函数。我不确定它是否与Matlab语义完全相同:

im.transform(size, AFFINE, data) => image

im.transform(size, AFFINE, data, filter) => image

Applies an affine transform to the image, and places the result in a new image with the given size.

Data is a 6-tuple (a, b, c, d, e, f) which contain the first two rows from an affine transform matrix. For each pixel (x, y) in the output image, the new value is taken from a position (a x + b y + c, d x + e y + f) in the input image, rounded to nearest pixel.

This function can be used to scale, translate, rotate, and shear the original image.

相关问题 更多 >