2015-09-25 79 views
0

我需要从一张大图片中提取一个感兴趣的对象(一辆车),现在我知道图片中这辆车的4个坐标。我怎么能裁剪此车在画面的图像,然后将其旋转到90度如下图所示如何裁剪和旋转python中的图像的一部分?

enter image description here

我需要它在Python程序,但我不知道要使用哪个库这个功能?

+0

使用PIL。 https://pypi.python.org/pypi/PIL 也有一个简单的任务很好的教程 - http://effbot.org/imagingbook/introduction.htm 裁剪 - http://effbot.org/imagingbook /introduction.htm#cutting-pasting-and-merging-images rotate - http://effbot.org/imagingbook/introduction.htm#geometrical-transforms – marmeladze

+0

除了已经提出的PIL之外,我还会添加[OpenCV] (https://opencv-python-tutroals.readthedocs.org/en/latest/)或[scikits-image](http://scikit-image.org/)。尽管任何这些库对于旋转对象都有点过大,但如果将来您需要稍微复杂些,它们可能会很有用。 –

回答