If you use cv2 , you are working with numpy arrays, and there is no need to access opencv for something as simple as a mask.
First, manipulate (possibly multiply) your array of masks so that the values ββyou want (that is, those that are not masked) have a value of 1. Then multiply the original image by your mask. This will make the resulting image have the original pixels, where masks == 1 and 0 (i.e.: black), where mask == 0.
Here is its essence:
import numpy original_ball = cv2.imread("Aqua-Ball-Red-icon.png") ball = cv2.resize(bola_original, (64,64), fx=1, fy=1) mask_original = cv2.imread("input-mask.png",0) mask = cv2.resize(mask_original, (64,64), fx=1, fy=1) max_value= numpy.max(mask) mask/=max_value res= ball*mask
Depending on the color depth of your input-mask.png, you may need to first reduce it in shades of gray
source share