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   天下无槛,不服就干  阅读(329)  评论(1编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示