fill pixels with zeros python opencv

x = y = 30
w = h = 100

mask = np.zeros(img.shape[:2],np.uint8)
mask[y:y+h,x:x+w] = 255
res = cv2.bitwise_and(img,img,mask = mask)

Here is what the above code is Doing:
1. We create a mask of the same size as the input image.
2. We fill the mask with zeros.
3. We draw a rectangle on the mask with the top-left corner at (x, y) and the width and height of the rectangle as w and h.
4. We use the bitwise_and function to apply the mask to the input image.
5. We save the result in the res variable.