How to use image masking to crop around a complex image?

import cv2

aml = cv2.imread('d:/test/1.jpg')
aml2 = cv2.imread('d:/test/AML.png', 0)
aml=cv2.cvtColor(aml, cv2.COLOR_BGR2BGRA)
cv2.insertChannel(src=aml2, dst=aml, coi=3);
cv2.imwrite("d:/test/test.png",aml)
1 Like