openCV 扩图

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)

 

posted on 2019-01-18 11:25  天下无槛,不服就干  阅读(322)  评论(1编辑  收藏  举报

导航