Exemplo n.º 1
0
 def __init__(self,base_cam,X3d,x2d,geom=None):
     self.base_cam = base_cam
     self.X3d = X3d
     self.x2d = x2d
     intrinsics = self.base_cam.to_dict()
     del intrinsics['Q']
     del intrinsics['translation']
     del intrinsics['name']
     self.intrinsic_dict = intrinsics
     self._obj_dist = []
     self.npts = len(self.X3d)
     if geom is not None:
         self.debug = True
     else:
         self.debug = False
     if PLOT and self.debug:
         plt.ion()
         self.fig = plt.figure()
         self.ax3d = self.fig.add_subplot(211, projection='3d')
         self.ax2d = self.fig.add_subplot(212)
         self.ax3d.set_xlabel('x')
         self.ax3d.set_ylabel('y')
         self.ax3d.set_zlabel('z')
         self.geom = geom
         self.plot_verts = get_3d_verts(self.geom)
Exemplo n.º 2
0
 def __init__(self, base_cam, X3d, x2d, geom=None):
     self.base_cam = base_cam
     self.X3d = X3d
     self.x2d = x2d
     intrinsics = self.base_cam.to_dict()
     del intrinsics['Q']
     del intrinsics['translation']
     del intrinsics['name']
     self.intrinsic_dict = intrinsics
     self._obj_dist = []
     self.npts = len(self.X3d)
     if geom is not None:
         self.debug = True
     else:
         self.debug = False
     if PLOT and self.debug:
         plt.ion()
         self.fig = plt.figure()
         self.ax3d = self.fig.add_subplot(211, projection='3d')
         self.ax2d = self.fig.add_subplot(212)
         self.ax3d.set_xlabel('x')
         self.ax3d.set_ylabel('y')
         self.ax3d.set_zlabel('z')
         self.geom = geom
         self.plot_verts = get_3d_verts(self.geom)
Exemplo n.º 3
0
def plot_setup(geometry_filename, display_bagfiles):
    geom = simple_geom.Geometry(geometry_filename)
    displays = [
        pymvg.CameraModel.load_camera_from_bagfile(dbf)
        for dbf in display_bagfiles
    ]

    print geometry_filename
    print display_bagfiles
    print[d.get_name() for d in displays]

    display = displays[0]

    tcs = np.zeros((display.height, display.width, 2)) - 1

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')

    verts = get_3d_verts(geom)
    ax.plot(verts[:, 0], verts[:, 1], verts[:, 2], 'ko')

    for display in displays:
        plot_camera(ax, display)

        ax.set_xlabel('x')
        ax.set_ylabel('y')
        ax.set_zlabel('z')

    if 1:
        fig = plt.figure()
        n = len(displays)
        for i in range(n):
            display = displays[i]
            ax = fig.add_subplot(n, 1, i + 1)
            pts = display.project_3d_to_pixel(verts)
            ax.plot(pts[:, 0], pts[:, 1], 'ko')
            ax.set_xlim([0, display.width])
            ax.set_ylim([0, display.height])
            ax.set_title(display.name)

    if 1:
        plt.show()
Exemplo n.º 4
0
               display_bagfiles):
    geom = simple_geom.Geometry(geometry_filename)
    displays = [pymvg.CameraModel.load_camera_from_bagfile(dbf) for dbf in display_bagfiles]

    print geometry_filename
    print display_bagfiles
    print [d.get_name() for d in displays]

    display = displays[0]

    tcs = np.zeros( (display.height,display.width,2))-1

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')

    verts = get_3d_verts(geom)
    ax.plot( verts[:,0], verts[:,1], verts[:,2], 'ko' )

    for display in displays:
        plot_camera(ax, display)

        ax.set_xlabel('x')
        ax.set_ylabel('y')
        ax.set_zlabel('z')

    if 1:
        fig = plt.figure()
        n = len(displays)
        for i in range(n):
            display = displays[i]
            ax = fig.add_subplot(n,1,i+1)