(self, ay, ax, by, bx)
return np.sum(((self.A[ay - dy0:ay + dy1, ax - dx0:ax + dx1] - self.B[by - dy0:by + dy1, bx - dx0:bx + dx1]) ** 2) + (
            (self.AA[ay - dy0:ay + dy1, ax - dx0:ax + dx1] - self.BB[by - dy0:by + dy1, bx - dx0:bx + dx1]) ** 2)) / ((dx1 + dx0) * (dy1 + dy0))
Calculate distance between a patch in A to a patch in B.
        :return: Distance calculated between the two patches
Calculate distance between a patch in A to a patch in B.
        :return: Distance calculated between the two patches
Calculate distance between a patch in A to a patch in B . : return : Distance calculated between the two patches
def cal_dist(self, ay, ax, by, bx):
        """
        Calculate distance between a patch in A to a patch in B.
        :return: Distance calculated between the two patches
        """
        dx0 = dy0 = self.patch_size // 2
        dx1 = dy1 = self.patch_size // 2 + 1
        dx0 = min(ax, bx, dx0)
        dx1 = min(self.A.shape[0] - ax, self.B.shape[0] - bx, dx1)
        dy0 = min(ay, by, dy0)
        dy1 = min(self.A.shape[1] - ay, self.B.shape[1] - by, dy1)
        return np.sum(((self.A[ay - dy0:ay + dy1, ax - dx0:ax + dx1] - self.B[by - dy0:by + dy1, bx - dx0:bx + dx1]) ** 2) + (
            (self.AA[ay - dy0:ay + dy1, ax - dx0:ax + dx1] - self.BB[by - dy0:by + dy1, bx - dx0:bx + dx1]) ** 2)) / ((dx1 + dx0) * (dy1 + dy0))
def cal_dist ( self , ay , ax , by , bx ) : dx0 = dy0 = self . patch_size // 2 dx1 = dy1 = self . patch_size // 2 + 1 dx0 = min ( ax , bx , dx0 ) dx1 = min ( self . A . shape [ 0 ] - ax , self . B . shape [ 0 ] - bx , dx1 ) dy0 = min ( ay , by , dy0 ) dy1 = min ( self . A . shape [ 1 ] - ay , self . B . shape [ 1 ] - by , dy1 ) return np . sum ( ( ( self . A [ ay - dy0 : ay + dy1 , ax - dx0 : ax + dx1 ] - self . B [ by - dy0 : by + dy1 , bx - dx0 : bx + dx1 ] ) ** 2 ) + ( ( self . AA [ ay - dy0 : ay + dy1 , ax - dx0 : ax + dx1 ] - self . BB [ by - dy0 : by + dy1 , bx - dx0 : bx + dx1 ] ) ** 2 ) ) / ( ( dx1 + dx0 ) * ( dy1 + dy0 ) )