1
2
3
4
5
6
7
8
9
10
11
12
|
import cv2
import numpy as np
import matplotlib.pyplot as plt
path = r'F:\img\lena.jpg'
img = cv2.imread(path,cv2.IMREAD_COLOR)
img[0:5,:,:] = [0,0,255]
img[:,0:5,:] = [0,0,255]
img[:,img.shape[1]-5:img.shape[1],:] = [0,0,255]
img[img.shape[0]-5:img.shape[0],:,:] = [0,0,255]
rgb = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
plt.imshow(rgb)
plt.axis('off')
|