[Python] Picture dimension reduction

Discussão em 'Python' iniciado por Stack, Maio 9, 2025.

  1. Stack

    Stack Membro Participativo

    I need to reduce my picture dimension by means of singular value decomposition.

    I've seen a lot of sources for this theme. They advise to use the following:

    m, n = img.shape
    U, S, V = np.linalg.svd(img)
    #U.shape = m * m; S.shape = m * n; V.shape = n * n
    img_cut = U[:, :x] @ np.diag(S[:x, :x]) @ V[:x, :]


    This is supposed to reduce the size of the image down to x. But the size of the image will be the same m * n, because U.shape[0] and V.shape[1] are remained the same. What can I do?

    Continue reading...

Compartilhe esta Página