(self, size)
return img
Upsample NNF based on size. It uses nearest neighbour interpolation
        :param size: INT size to upsample to.

        :return: upsampled NNF
Upsample NNF based on size. It uses nearest neighbour interpolation
        :param size: INT size to upsample to.
Upsample NNF based on size . It uses nearest neighbour interpolation : param size : INT size to upsample to .
def upsample_nnf_ori(self, size):
        """
        Upsample NNF based on size. It uses nearest neighbour interpolation
        :param size: INT size to upsample to.

        :return: upsampled NNF
        """

        temp = np.zeros((self.nnf.shape[0], self.nnf.shape[1], 3))

        for y in range(self.nnf.shape[0]):
            for x in range(self.nnf.shape[1]):
                temp[y][x] = [self.nnf[y][x][0], self.nnf[y][x][1], 0]

        img = np.zeros(shape=(size, size, 2), dtype=np.int)
        small_size = self.nnf.shape[0]
        aw_ratio = ((size) // small_size)
        ah_ratio = ((size) // small_size)

        temp = cv2.resize(temp, None, fx=aw_ratio, fy=aw_ratio, interpolation=cv2.INTER_NEAREST)

        for i in range(temp.shape[0]):
            for j in range(temp.shape[1]):
                pos = temp[i, j]
                img[i, j] = pos[0] * aw_ratio, pos[1] * ah_ratio

        return img
def upsample_nnf_ori ( self , size ) : temp = np . zeros ( ( self . nnf . shape [ 0 ] , self . nnf . shape [ 1 ] , 3 ) ) for y in range ( self . nnf . shape [ 0 ] ) : for x in range ( self . nnf . shape [ 1 ] ) : temp [ y ] [ x ] = [ self . nnf [ y ] [ x ] [ 0 ] , self . nnf [ y ] [ x ] [ 1 ] , 0 ] img = np . zeros ( shape = ( size , size , 2 ) , dtype = np . int ) small_size = self . nnf . shape [ 0 ] aw_ratio = ( ( size ) // small_size ) ah_ratio = ( ( size ) // small_size ) temp = cv2 . resize ( temp , None , fx = aw_ratio , fy = aw_ratio , interpolation = cv2 . INTER_NEAREST ) for i in range ( temp . shape [ 0 ] ) : for j in range ( temp . shape [ 1 ] ) : pos = temp [ i , j ] img [ i , j ] = pos [ 0 ] * aw_ratio , pos [ 1 ] * ah_ratio return img