1、扩图
import cv2
import numpy as np
img=cv2.imread('Test2.jpg',1)
width=img.shape[0]
height=img.shape[1]
dst=np.zeros((200,200,3),np.uint8)
for i in range(200):
for j in range(200):
if i>30 and j>30 and i<190 and j<120:
print(i,j)
dst[i,j]=img[i-30,j-30]
else:
dst[i,j]=(111,111,111)
cv2.imshow('dst',dst)
cv2.imshow('src',img)
redst=cv2.resize(dst,(64,128))
cv2.imwrite('34.jpg',redst,[cv2.IMWRITE_JPEG_QUALITY,100])
cv2.waiTKEy(0)
0