python - How to Mask an image using Numpy/OpenCV? -
I load an image I: I want to put that image in the center of the image. I have created a circle in the area as a mask that I want to keep. I made a circle with it: Can I mask out the original image? does not work. Of
im = the cv2.imread (file Name)
height, width, depth = im.shape circle = np .zeros ((height, width)) cv2.circle (circle , (Width / 2, height / 2), 280,1, thickness = -1)
masked_data = im * cycle
cv2.bitwise_and
and mask Chakra passes in the form
im = cv2.imread (filename) height, width, depth = im.shape circle_img = np.zeros ((height, width), np.uint8) cv2.circle (circle_img (width / 2, height / 2), 280.1, thickness = -1) masked_data = cv2.bitwise_and (IM, IM, mask = circle_img) cv2.imshow ( "masked", masked_data) cv2.waitKey (0)
Comments
Post a Comment