I have been following examples for a script that I can use to feather (blur) edges of masked images. In just about every example I get to a point where they use an operation like mask==np.array[(255,255,255]) to replace the target image with the sections from the masked image. However, whenever I run these scripts I receive a deprecation warning and no result:
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:13: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
I’m guessing this is using a deprecated numpy functionality and I’m not sure how to move forward. I’ve put my full code below. I am a beginner and my ultimate goal is to create a solid system for batch feathering from masked frames, so if anyone has further suggestions or reading materials on this topic let me know!
image = cv2.imread('/content/drive/image.png') mask1 = np.zeros(image.shape[:2], dtype="uint8") cv2.circle(mask1, (500, 500), 500, 255, 30) mask2 = np.zeros(image.shape[:2], dtype="uint8") cv2.circle(mask2, (500, 500), 500, (255,255,255), -1) masked = cv2.bitwise_and(image, image, mask=mask1) masked2 = cv2.bitwise_and(image, image, mask=mask2) feathered = cv2.GaussianBlur(masked, (21,21), 50) output = np.where(mask2==np.array([255,255,255]), masked2, feathered)