Skip to content

Commit 12897dc

Browse files
authored
Python visualizer improvements (#13)
1 parent 9465f4f commit 12897dc

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

python/cli/visualization/visualizer.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,11 @@ def onVioOutput(self, cameraPose, image=None, width=None, height=None, colorForm
450450
if image is not None:
451451
# Flip the image upside down for OpenGL.
452452
if not self.args.flip: image = np.ascontiguousarray(np.flipud(image))
453+
output["image"] = image
453454
output['width'] = width
454455
output['height'] = height
455456
output['colorFormat'] = colorFormat
456457

457-
458458
if self.outputQueueMutex:
459459
self.outputQueue.append(output)
460460

@@ -476,6 +476,7 @@ def onMappingOutput(self, mapperOutput):
476476

477477
def run(self):
478478
vioOutput = None
479+
prevVioOutput = None
479480
wasTracking = False
480481

481482
while not self.shouldQuit:
@@ -507,12 +508,20 @@ def run(self):
507508
mapperOutput = output["mapperOutput"]
508509
if wasTracking: # Don't render if not tracking. Messes up this visualization easily
509510
self.map.onMappingOutput(mapperOutput)
510-
if mapperOutput.finalMap and not self.args.keepOpenAfterFinalMap:
511-
self.shouldQuit = True
511+
if mapperOutput.finalMap:
512+
if self.args.keepOpenAfterFinalMap:
513+
self.showCameraFrustum = False
514+
self.showCameraModel = False
515+
if self.args.targetFps == 0: self.args.targetFps = 30 # No vio outputs -> set 30fps mode instead
516+
if self.cameraSmooth: self.cameraSmooth.reset() # Stop camera moving automatically
517+
vioOutput = prevVioOutput
518+
else:
519+
self.shouldQuit = True
512520
else:
513521
print("Unknown output type: {}".format(output["type"]))
514522

515523
if vioOutput:
524+
prevVioOutput = vioOutput
516525
self.__render(
517526
vioOutput["cameraPose"],
518527
vioOutput["width"],

0 commit comments

Comments
 (0)