[Python] Comparing Image Patches in Python

Discussão em 'Python' iniciado por Stack, Julho 5, 2025.

  1. Stack

    Stack Membro Participativo

    I have a problem in which I have to compare two image patches and determine how similar they are by returning a value that determines their similarity. I've already written a function for this, and I'm using opencv to do this.

    def compare_patches(self, patch1: np.ndarray, patch2: np.ndarray):
    diff = patch1 - patch2
    avg = np.mean(diff)
    return abs(avg)


    Each image from each patch is 640x480, and the size of each patch is currently 11x11.

    Can someone explain to me what I'm doing wrong, or if there is a better way to do this process?

    Continue reading...

Compartilhe esta Página