(self, img_a)
return final_img
Reconstruct image using the NNF and img_a.
        :param img_a: the patches to reconstruct from
        :return: reconstructed image
Reconstruct image using the NNF and img_a.
        :param img_a: the patches to reconstruct from
        :return: reconstructed image
Reconstruct image using the NNF and img_a . : param img_a : the patches to reconstruct from : return : reconstructed image
def reconstruct_image(self, img_a):
        """
        Reconstruct image using the NNF and img_a.
        :param img_a: the patches to reconstruct from
        :return: reconstructed image
        """
        final_img = np.zeros_like(img_a)
        size = self.nnf.shape[0]
        scale = img_a.shape[0] // self.nnf.shape[0]
        for i in range(size):
            for j in range(size):
                x, y = self.nnf[i, j]
                if final_img[scale * i:scale * (i + 1), scale * j:scale * (j + 1)].shape == img_a[scale * y:scale * (y + 1), scale * x:scale * (x + 1)].shape:
                    final_img[scale * i:scale * (i + 1), scale * j:scale * (j + 1)] = img_a[scale * y:scale * (y + 1), scale * x:scale * (x + 1)]
        return final_img
def reconstruct_image ( self , img_a ) : final_img = np . zeros_like ( img_a ) size = self . nnf . shape [ 0 ] scale = img_a . shape [ 0 ] // self . nnf . shape [ 0 ] for i in range ( size ) : for j in range ( size ) : x , y = self . nnf [ i , j ] if final_img [ scale * i : scale * ( i + 1 ) , scale * j : scale * ( j + 1 ) ] . shape == img_a [ scale * y : scale * ( y + 1 ) , scale * x : scale * ( x + 1 ) ] . shape : final_img [ scale * i : scale * ( i + 1 ) , scale * j : scale * ( j + 1 ) ] = img_a [ scale * y : scale * ( y + 1 ) , scale * x : scale * ( x + 1 ) ] return final_img