Python用來處理圖像幾何變換的方法供大家學(xué)習(xí)和參考。文章來源地址http://www.zghlxwxcb.cn/news/detail-618515.html
1.?[代碼][Python]代碼?
import Image
try:
im=Image.open('test.jpg')
#out = im.resize((128, 128)) #改變大小
#out = im.rotate(45) #45°旋轉(zhuǎn)
#out = im.transpose(Image.FLIP_LEFT_RIGHT) #水平翻轉(zhuǎn)
#out = im.transpose(Image.FLIP_TOP_BOTTOM) #垂直翻轉(zhuǎn)
#out = im.transpose(Image.ROTATE_90) # 90
#out = im.transpose(Image.ROTATE_180) #180°順時(shí)針翻轉(zhuǎn)
out = im.transpose(Image.ROTATE_270) #270°順時(shí)針翻轉(zhuǎn)
out.save('test2.jpg')
except IOError:
print 'No File!'
文章來源:http://www.zghlxwxcb.cn/news/detail-618515.html
到了這里,關(guān)于Python用來處理圖像幾何變換的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!