zoukankan      html  css  js  c++  java
  • QR & RQ Factorization

    from the documentation (here is a page that shows it though). To use this version, import rq like this:


    from scipy.linalg import rq


    Alternatively, you can use the more common QR factorization and with some modifications write your own RQ function. 


    from scipy.linalg import qr

    def rq(A):
    Q,R = qr(flipud(A).T)
    R = flipud(R.T)
    Q = Q.T
    return R[:,::-1],Q[::-1,:]


    RQ factorization is not unique. The sign of the diagonal elements can vary. In computer vision we need them to be positive to correspond to focal length and other positive parameters. To get a consistent result with positive diagonal you can apply a transform that changes the sign. Try this on a camera matrix like this:


    # factor first 3*3 part of P
    K,R = rq(P[:,:3])

    # make diagonal of K positive
    T = diag(sign(diag(K)))

    K = dot(K,T)
    R = dot(T,R) #T is its own inverse


    The RQ decomposition transforms a matrix A into the product of an upper triangular matrix R (also known as right-triangular) and an orthogonal matrix Q. The only difference from QR decomposition is the order of these matrices.

    QR decomposition is Gram–Schmidt orthogonalization of columns of A, started from the first column.

    RQ decomposition is Gram–Schmidt orthogonalization of rows of A, started from the last row.

  • 相关阅读:
    subprocess使用小方法
    POJ3694 Network
    pickle 两个使用小方法
    软件补丁问题(SPFA+位运算)
    auto_ftp_sh
    幸运数字 容斥
    python调用脚本或shell的方式
    奇技淫巧
    运算符
    条件循环控制
  • 原文地址:https://www.cnblogs.com/ShaneZhang/p/3134655.html
Copyright © 2011-2022 走看看