/**
 * Given two images, returns the number of common pixels between them.
 * @param img1 First image as a numpy array.
 * @param img2 Second image as a numpy array.
 * @return Number of common pixels between the two images.
 */
fun findCommonPixels(img1: Array<IntArray>, img2: Array<IntArray>): Int {

    // Check if the two images have the same shape
    require(img1.size == img2.size && img1[0].size == img2[0].size) { "Images must have the same shape." }

    // Calculate the number of common pixels
    var commonPixels = 0
    for (i in img1.indices) {
        for (j in img1[i].indices) {
            if (img1[i][j] != 0 && img2[i][j] != 0) {
                commonPixels++
            }
        }
    }

    return commonPixels
}
/**
 * Given two images, returns the number of common pixels between them.
 * @param img1 First image as a numpy array.
 * @param img2 Second image as a numpy array.
 * @return Number of common pixels between the two images.
 */
fun findCommonPixels(img1: Array<IntArray>, img2: Array<IntArray>): Int {
/**
 * Given two images, returns the number of common pixels between them.
 * @param img1 First image as a numpy array.
 * @param img2 Second image as a numpy array.
 * @return Number of common pixels between the two images.
 */
fun findCommonPixels(img1: Array<IntArray>, img2: Array<IntArray>): Int {

    // Check if the two images have the same shape
    require(img1.size == img2.size && img1[0].size == img2[0].size) { "Images must have the same shape." }

    // Calculate the number of common pixels
    var commonPixels = 0
    for (i in img1.indices) {
        for (j in img1[i].indices) {
            if (img1[i][j] != 0 && img2[i][j] != 0) {
                commonPixels++
            }
        }
    }

    return commonPixels
}