原理:将范围内10*10的像素全部赋值为第一个像素的值
import cv2
import numpy as np
img = cv2.imread('D:/pythonob/imageinpaint/img/zidan.jpg',1)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
for i in range(100,200):
for j in range(100,300):
if i%10 == 0 and j%10 == 0:
for m in range(0,10):
for n in range(0,10):
(b,g,r) = img[i,j]
img[i+m,j+n] = (b,g,r)
cv2.imshow('masaike',img)
cv2.waitKey(0)
效果图: