Exemplo n.º 1
0
def showCalib(K,image,dg=5,col=(128,128,128)):
    HEIGHT, WIDTH = image.shape[:2]
    cv.line(image,(0,HEIGHT//2),(WIDTH,HEIGHT//2),col,1,lineType)
    cv.line(image,(WIDTH//2,0),(WIDTH//2,HEIGHT),col,1,lineType)
    AW = WIDTH*1//100
    for ang in range(-45,46,dg):
        x,_ = htrans(K,row(np.sin(ang*np.pi/180),0))[0].astype(int)
        x += HEIGHT//2 - WIDTH//2
        cv.line(image,(WIDTH//2-AW,x),(WIDTH//2+AW,x),col,1,lineType)
        x += -HEIGHT//2 + WIDTH//2
        cv.line(image,(x,HEIGHT//2-AW),(x,HEIGHT//2+AW),col,1,lineType)
Exemplo n.º 2
0
def cameraOutline2(M, sc = 0.3):

    K,R,C = sepcam(M)
    
    # formamos una transformación 3D para mover la cámara en el origen a la posición de M
    rt = jr(jc(R, -R @ col(C)),
            row(0,0,0,1))
    
    x = 1;
    y = x;
    z = 0.99;
    
    ps =[x,    0,    z,
         (-x), 0,    z,
         0,    0,    z,
         0,    1.3*y,z,
         0,    (-y), z,
         x,    (-y), z,
         x,    y,    z,
         (-x), y,    z,
         (-x), (-y), z,
         x,    (-y), z,
         x,    y,    z,
         0,    y,    z,
         0,    0,    z,
         0,    0,    0,
         1,    1,    z,
         0,    0,    0,
         (-1), 1,    z,
         0,    0,    0,
         (-1), (-1), z,
         0,    0,    0,
         (1), (-1),  z,
         0,    0,    0,
         0,    0,    (2*x)]
    
    ps = np.array(ps).reshape(-1,3)
    return htrans(la.inv(rt), sc * ps)
Exemplo n.º 3
0
def cameraTransf(M):
    K, R, C = sepcam(M)
    rt = jr(jc(R, -R @ col(C)), row(0, 0, 0, 1))
    return la.inv(rt)
Exemplo n.º 4
0
def cameraTransf(p):
    return jr(jc(p.R, col(p.t)), row(0, 0, 0, 1))
Exemplo n.º 5
0
def cameraTransf2(M):
    K, R, C = sepcam(M)
    rt = jr(jc(R, -R @ col(C)), row(0, 0, 0, 1))
    return rt