You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
847 B

# coding=gbk
import cv2
import numpy as np
def bigger(filepath,x,y):#放缩
src = cv2.imread(filepath+'image1.png')
src = cv2.resize(src, (x, y))
cv2.imwrite(filepath + 'out.png', src)
def mirror1(filepath):#水平镜像
src = cv2.imread(filepath + 'image1.png')
horizontal = cv2.flip(src, 1, dst=None)
cv2.imwrite(filepath + 'out.png', horizontal)
def mirror2(filepath):#垂直镜像
src = cv2.imread(filepath + 'image1.png')
vertical = cv2.flip(src, 0, dst=None)
cv2.imwrite(filepath + 'out.png', vertical)
def mirror3(filepath):#对角镜像
src = cv2.imread(filepath + 'image1.png')
cross = cv2.flip(src, -1, dst=None)
cv2.imwrite(filepath + 'out.png', cross)
if __name__ == '__main__':
filepath = 'pic/'
bigger(filepath,256,256)
mirror1(filepath)
mirror2(filepath)
mirror3(filepath)