Cannot determine Numba type of <class ‘numba.core.dispatcher.LiftedLoop‘

Cannot determine Numba type of

解决ok。

代码:

@jit()
def initial_background(I_gray, N):
    # symmetric:对称填充
    I_pad = np.pad(I_gray, 1, 'symmetric')
    height = I_pad.shape[0]
    width = I_pad.shape[1]
    samples = np.zeros((height, width, N))
    for i in range(1, height - 1):
        for j in range(1, width - 1):
            for n in range(N):
                x, y = 0, 0
                while (x == 0 and y == 0):
                    x = np.random.randint(-1, 1)
                    y = np.random.randint(-1, 1)
                ri = i + x
                rj = j + y
                samples[i, j, n] = I_pad[ri, rj]
    samples = samples[1:height - 1, 1:width - 1]
    return samples

报错:

Compilation is falling back to object mode WITH looplifting

你可能感兴趣的:(python宝典,计算机视觉,opencv,前端)