예제 #1
0
    def viewer_init(self, w, h):
        pangolin.CreateWindowAndBind('Map Viewer', w, h)
        gl.glEnable(gl.GL_DEPTH_TEST)

        self.scam = pangolin.OpenGlRenderState(
            pangolin.ProjectionMatrix(w, h, 420, 420, w // 2, h // 2, 0.2,
                                      10000),
            pangolin.ModelViewLookAt(0, -10, -8, 0, 0, 0, 0, -1, 0))
        self.handler = pangolin.Handler3D(self.scam)

        # Create Interactive View in window
        self.dcam = pangolin.CreateDisplay()
        self.dcam.SetBounds(0.0, 1.0, 0.0, 1.0, w / h)
        self.dcam.SetHandler(self.handler)
        # hack to avoid small Pangolin, no idea why it's *2
        self.dcam.Resize(pangolin.Viewport(0, 0, w * 2, h * 2))
        self.dcam.Activate()
예제 #2
0
    def viewer_init(self, W, H):
        pangolin.CreateWindowAndBind('Map View', W, H)
        gl.glEnable(gl.GL_DEPTH_TEST)

        self.scam = pangolin.OpenGlRenderState(
                pangolin.ProjectionMatrix(W, H, 420, 420, W//2, H//2, 0.2, 10000),
                pangolin.ModelViewLookAt(0, -10, -8, 0, 0, 0, 0, -1, 0))
        self.handler = pangolin.Handler3D(self.scam)

        # create the interactive window
        self.dcam = pangolin.CreateDisplay()
        self.dcam.SetBounds(0.0, 1.0, 0.0, 1.0, W/H)
        self.dcam.SetHandler(self.handler)

        # avoid small Pangolin
        self.dcam.Resize(pangolin.Viewport(0, 0, W*2, H*2))
        self.dcam.Activate()
예제 #3
0
def main():
	w, h = 640, 480
	pangolin.CreateWindowAndBind('Main', 640, 480)
	gl.glEnable(gl.GL_DEPTH_TEST)

	# Create Interactive View in window
	scam = pangolin.OpenGlRenderState(
	  pangolin.ProjectionMatrix(w, h, 420, 420, w//2, h//2, 0.2, 10000),
	  pangolin.ModelViewLookAt(0, -10, -8,
							   0, 0, 0,
							   0, -1, 0))
	handler = pangolin.Handler3D(scam)

	# Create Interactive View in window
	dcam = pangolin.CreateDisplay()
	dcam.SetBounds(0.0, 1.0, 0.0, 1.0, w/h)
	dcam.SetHandler(handler)
	# hack to avoid small Pangolin, no idea why it's *2
	dcam.Resize(pangolin.Viewport(0,0,w*2,h*2))
	dcam.Activate()

	poses = []
	# pose = np.hstack((np.identity(3), np.zeros((3,1))))
	pose = np.identity(4)
	poses.append(np.linalg.inv(pose))
	while not pangolin.ShouldQuit():
		gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
		gl.glClearColor(0.0, 0.0, 0.0, 1.0)
		dcam.Activate(scam)

		pose[2, 3] = pose[2, 3] - 1
		poses.append(np.linalg.inv(pose))

		print(poses[-1])

		gl.glLineWidth(3)
		gl.glColor3f(0.0, 1.0, 0.0)
		pangolin.DrawCameras(poses)
		# pangolin.DrawCamera(pose)
		time.sleep(0.2) 
		# pangolin.DrawCameras(np.linalg.inv(poses[-1]))
		# pangolin.DrawCameras(np.stack(poses, axis=0))
		# print(np.stack(poses,axis=2).shape)
		pangolin.FinishFrame()
예제 #4
0
def main():
    pangolin.CreateWindowAndBind('Main', 640, 480)
    gl.glEnable(gl.GL_DEPTH_TEST)

    # Define Projection and initial ModelView matrix
    scam = pangolin.OpenGlRenderState(
        pangolin.ProjectionMatrix(640, 480, 420, 420, 320, 240, 0.2, 100),
        pangolin.ModelViewLookAt(-2, 2, -2, 0, 0, 0,
                                 pangolin.AxisDirection.AxisY))
    handler = pangolin.Handler3D(scam)

    # Create Interactive View in window
    dcam = pangolin.CreateDisplay()
    dcam.SetBounds(0.0, 1.0, 0.0, 1.0, -640.0 / 480.0)
    dcam.SetHandler(handler)
    dcam.Resize(pangolin.Viewport(0, 0, 640 * 2, 480 * 2))

    while not pangolin.ShouldQuit():
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
        gl.glClearColor(1.0, 1.0, 1.0, 1.0)
        dcam.Activate(scam)

        # Render OpenGL Cube
        pangolin.glDrawColouredCube()

        # Draw Point Cloud
        points = np.random.random((100000, 3)) * 10
        colors = np.zeros((len(points), 3))
        colors[:, 1] = 1 - points[:, 0] / 10.
        colors[:, 2] = 1 - points[:, 1] / 10.
        colors[:, 0] = 1 - points[:, 2] / 10.

        gl.glPointSize(2)
        gl.glColor3f(1.0, 0.0, 0.0)
        # access numpy array directly(without copying data), array should be contiguous.
        pangolin.DrawPoints(points, colors)

        pangolin.FinishFrame()
예제 #5
0
h = 768

pangolin.CreateWindowAndBind('Map Viewer', w, h)
gl.glEnable(gl.GL_DEPTH_TEST)

scam = pangolin.OpenGlRenderState(
    pangolin.ProjectionMatrix(w, h, 420, 420, w // 2, h // 2, 0.2, 10000),
    pangolin.ModelViewLookAt(0, -10, -8, 0, 0, 0, 0, -1, 0))
handler = pangolin.Handler3D(scam)

# Create Interactive View in window
dcam = pangolin.CreateDisplay()
dcam.SetBounds(0.0, 1.0, 0.0, 1.0, w / h)
dcam.SetHandler(handler)
# hack to avoid small Pangolin, no idea why it's *2
dcam.Resize(pangolin.Viewport(0, 0, w * 2, h * 2))
dcam.Activate()

while not pangolin.ShouldQuit():
    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
    gl.glClearColor(0.0, 0.0, 0.0, 1.0)
    dcam.Activate(scam)
    if state is not None:
        if state[0].shape[0] >= 2:
            gl.glColor3f(0.0, 1.0, 0.0)
            pangolin.DrawCameras(state[0][:-1])
        if state[0].shape[0] >= 1:
            gl.glColor3f(1.0, 1.0, 0.0)
            pangolin.DrawCameras(state[0][-1:])
        # if state[1].shape[0] != 0:
        #     gl.glPointSize(1)