I'm totally new in OpenCV. Does anyone knows how to convert below Python into Java/Kotlin? Only these a bit tricky to translate it.
diff=cv2.subtract(img1, img2)
diff[abs(diff)<30]=0
gray = cv2.cvtColor(diff.astype(np.uint8), cv2.COLOR_BGR2GRAY)
gray[np.abs(gray) < 10] = 0
mask_img = gray.astype(np.uint8)
mask_img[mask_img>0]=255 // invert the mask
mask_img_inv = cv2.bitwise_not(mask_img)
finalImg = cv2.bitwise_and(img1, img1, mask = mask_img)