import cv2
img = cv2.imread("3.1.jpeg")
dst1 = cv2.resize(img,(100,400))
dst2 = cv2.resize(img,(400,400))
cv2.imshow("img",img)
cv2.imshow("dst1",dst1)
cv2.imshow("dst2",dst2)
cv2.waitKey()
cv2.destroyAllWindows()
dst3 = cv2.resize(img,None,fx=1 / 3,fy=1 / 2)
dst4 = cv2.resize(img,None,fx=2,fy=2)
cv2.imshow("dst3",dst3)
cv2.imshow("dst4",dst4)
cv2.waitKey()
cv2.destroyAllWindows()
dst1 = cv2.flip(img,0)
dst2 = cv2.flip(img,1)
dst3 = cv2.flip(img,-1)
cv2.imshow("dst1",dst1)
cv2.imshow("dst2",dst2)
cv2.imshow("dst3",dst3)
cv2.waitKey()
cv2.destroyAllWindows()
import numpy as np
rows = len(img)
cols = len(img[0])
M = np.float32([[1,0,50],[0,1,100]])
dst = cv2.warpAffine(img,M,(cols,rows))
cv2.imshow("dst",dst)
cv2.waitKey()
cv2.destroyAllWindows()
center = (rows/2,cols/2)
M = cv2.getRotationMatrix2D(center,30,0.8)
dst = cv2.warpAffine(img,M,(cols,rows))
cv2.imshow("dst",dst)
cv2.waitKey()
cv2.destroyAllWindows()
dst1 = cv2.resize(img,(400,400))
dst2 = cv2.resize(img,(400,200))
dst3 = cv2.resize(img,(400,200))
fontStyle = cv2.FONT_HERSHEY_TRIPLEX
cv2.putText(dst2,"WQ",(20,90),fontStyle,1,(0,0,255))
cv2.putText(dst3,"20040420",(20,90),fontStyle,1,(0,0,255))
dst4 = cv2.resize(img,(200,200))
dst5 = cv2.resize(img,(200,200))
dst5 = cv2.flip(dst5,1)
dst8 = cv2.resize(img,(200,200))
dst8 = cv2.flip(dst8,0)
dst9 = cv2.resize(img,(200,200))
dst9 = cv2.flip(dst9,-1)
dst6 = cv2.resize(img,(200,200))
rows = len(dst6)
cols = len(dst6[0])
M = np.float32([[1,0,-100],[0,1,-50]])
dst6 = cv2.warpAffine(dst6,M,(cols,rows))
black_white = cv2.resize(img,(200,400))
for i in range(0,20):
for j in range(0,200):
black_white[i,j] = [255,255,255]
for i in range(40,60):
for j in range(0,200):
black_white[i,j] = [0,0,0]
for i in range(80,100):
for j in range(0,200):
black_white[i,j] = [255,255,255]
for i in range(120,140):
for j in range(0,200):
black_white[i,j] = [0,0,0]
for i in range(140,160):
for j in range(0,200):
black_white[i,j] = [255,255,255]
dst10 = cv2.resize(img,(200,200))
center = (rows/2,cols/2)
M = cv2.getRotationMatrix2D(center,30,0.5)
dst10 = cv2.warpAffine(dst10,M,(cols,rows))
img_h = np.hstack((dst1,dst1))
img_v = np.vstack((dst2,dst2))
img2 = np.vstack((dst2,dst3))
img2 = np.hstack((dst1,img2))
img3 = np.hstack((dst4,dst5,dst6))
img4 = np.hstack((dst8,dst9,dst10))
img3 = np.vstack((img3,img4))
img3 = np.hstack((img3,black_white))
img3 = np.vstack((img2,img3))
cv2.imshow("20040420",img3)
cv2.waitKey()
cv2.destroyAllWindows()