'An Inbuilt function to find Difference Between Two Images for Android (Kotlin Preferred)

In my app, I want to find the difference between two Images, almost similar but with a slight difference. The function should extract the difference and should give out an image that contains the difference it extracted. Input should be two images. (I saw another related question in StackOverflow but it was posted 8 years ago, and the solution was brute force approached) Please suggest a few functions (inbuilt functions preferred) in Kotlin, Thanks in advance!



Solution 1:[1]

    let message = "i bought a pear";
    const trigger = "bought";
    const exceptions = ["apple", "pear", "banana"];

    let newMessageArr = message.split(' ');
    exceptions.forEach((exception) => {
        console.log(exception);
        newMessageArr.forEach(word => {
            if( word === exception )
                console.log("true");
        })
    })

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DanielAJL