coastalimagelib/corefunctions.py
def dlt2UV(grid, cal):

    """
    This function computes the distorted UV coordinates (UVd)  that
    correspond to a set of world xyz points for a given camera m matrix
    for DLT equations

    Arguments:
        cal: CameraData object containing the DLT coefficient vector A->L
        grid: XYZGrid object containing real world coords

    Attributes:
        DU= Nx1 vector of distorted U coordinates for N points.
        DV= Nx1 vector of distorted V coordinates for N points.

    """

    m = np.asarray(cal.intrinsics)
    m = m.reshape(-1, 1)

    #  Carry out the equivalent vectorized calculation of
    #       U = (Ax + By + Cz + D) / (Ex + Fy + Gz + 1)
    #       V = (Hx + Jy + Kz + L) / (Ex + Fy + Gz + 1)

    x2 = np.hstack((grid.xyz, np.ones((grid.xyz.shape[0], 1))))

    denom = np.matmul(x2, np.vstack((m[4:7], 1)))
    U = np.matmul(x2, m[0:4]) / denom
    V = np.matmul(x2, m[7:11]) / denom

    DU = U.reshape(grid.X.shape, order="F")
    DV = V.reshape(grid.Y.shape, order="F")

    return DU, DV

    This function computes the distorted UV coordinates (UVd)  that
    correspond to a set of world xyz points for a given camera m matrix
    for DLT equations

    Arguments:
        cal: CameraData object containing the DLT coefficient vector A->L
        grid: XYZGrid object containing real world coords

    Attributes:
        DU= Nx1 vector of distorted U coordinates for N points.
        DV= Nx1 vector of distorted V coordinates for N points.

    
This function computes the distorted UV coordinates (UVd)  that
correspond to a set of world xyz points for a given camera m matrix
for DLT equations

CameraData object containing the DLT coefficient vector A->L
grid: XYZGrid object containing real world coords

DU= Nx1 vector of distorted U coordinates for N points.
DV= Nx1 vector of distorted V coordinates for N points.
This function computes the distorted UV coordinates ( UVd ) that correspond to a set of world xyz points for a given camera m matrix for DLT equations CameraData object containing the DLT coefficient vector A - > L grid : XYZGrid object containing real world coords DU = Nx1 vector of distorted U coordinates for N points . DV = Nx1 vector of distorted V coordinates for N points .
def dlt2UV(grid, cal):
    m = np.asarray(cal.intrinsics)
    m = m.reshape(-1, 1)
    x2 = np.hstack((grid.xyz, np.ones((grid.xyz.shape[0], 1))))
    denom = np.matmul(x2, np.vstack((m[4:7], 1)))
    U = np.matmul(x2, m[0:4]) / denom
    V = np.matmul(x2, m[7:11]) / denom
    DU = U.reshape(grid.X.shape, order="F")
    DV = V.reshape(grid.Y.shape, order="F")
    return DU, DV
def dlt2UV ( grid , cal ) : m = np . asarray ( cal . intrinsics ) m = m . reshape ( - 1 , 1 ) x2 = np . hstack ( ( grid . xyz , np . ones ( ( grid . xyz . shape [ 0 ] , 1 ) ) ) ) denom = np . matmul ( x2 , np . vstack ( ( m [ 4 : 7 ] , 1 ) ) ) U = np . matmul ( x2 , m [ 0 : 4 ] ) / denom V = np . matmul ( x2 , m [ 7 : 11 ] ) / denom DU = U . reshape ( grid . X . shape , order = "F" ) DV = V . reshape ( grid . Y . shape , order = "F" ) return DU , DV
This function computes the distorted UV coordinates (UVd)  that
correspond to a set of world xyz points for a given camera m matrix
for DLT equations
This function computes the distorted UV coordinates ( UVd ) that correspond to a set of world xyz points for a given camera m matrix for DLT equations
"""
    This function computes the distorted UV coordinates (UVd)  that
    correspond to a set of world xyz points for a given camera m matrix
    for DLT equations

    Arguments:
        cal: CameraData object containing the DLT coefficient vector A->L
        grid: XYZGrid object containing real world coords

    Attributes:
        DU= Nx1 vector of distorted U coordinates for N points.
        DV= Nx1 vector of distorted V coordinates for N points.

    """ #  Carry out the equivalent vectorized calculation of #       U = (Ax + By + Cz + D) / (Ex + Fy + Gz + 1) #       V = (Hx + Jy + Kz + L) / (Ex + Fy + Gz + 1)
grid
cal