python代码:
import cv2 as cv
import numpy as np
def custom_blur(src):
h, w, ch = src.shape
print("h , w, ch", h, w, ch)
result = np.copy(src)
for row in range(1, h-1, 1):
for col in range(1, w-1, 1):
v1 = np.int32(src[row-1, col-1])
v2 = np.int32(src[row-1, col])
v3 = np.int32(src[row-1, col+1])
v4 = np.int32(src[row, col-1])
v5 = np.int32(src[row, col])
v6 = np.int32(src[row, col+1])
v7 = np.int32(src[row+1, col-1])
v8 = np.int32(src[row+1, col])
v9 = np.int32(src[row+1, col+1])
b = v1[0] + v2[0] + v3[0] + v4[0] + v5[0] +