Welcome to DOFBOT Pro repository
5. Pixel Operation
5. OpenCV pixel operation
Pixel operation, we can change the pixel color at any position to a new one. Here we first read the image and then assign an area to white.
Code path:
x~/dofbot_pro/dofbot_opencv/scripts/1.OpenCV_basic/04_pixel_pic.ipynb
The main code is as follows:
ximport cv2
img = cv2.imread('yahboom.jpg',1)(b,g,r) = img[100,100]print(b,g,r)# bgr#10 100 --- 110 100i=j=0for j in range(1,500): img[i,j] = (255,255,255) for i in range(1,500): img[i,j] = (255,255,255)# cv2.imshow('image',img)# cv2.waitKey(0) #1000 ms