我裁剪并旋转到图片,我想填充边界。我用黑色区域制作了面具。并填充了4点裁剪图像的平均像素。这是填充的图像:
以下是裁剪和旋转后的图像:
这是我的代码:
sumarr = (cropped_image[5][5]).astype(int)+cropped_image[-5][-5].astype(int)+cropped_image[5][-5].astype(int)+cropped_image[-5][5].astype(int)
avg1 = sumarr[0]/4
avg2 = sumarr[1]/4
avg3 = sumarr[2]/4
target_value = [0, 0, 0]
background_value = [avg1, avg2, avg3]
mask = np.any(new_image == target_value, axis=-1)
new_image[mask] = background_value
如何删除黑线?