(self, cameraPose, image=None, width=None, height=None, colorFormat=None, status=None)
| 452 | if self.cameraMode is CameraMode.TOP_VIEW: self.cameraControls2D.update(event) |
| 453 | |
| 454 | def onVioOutput(self, cameraPose, image=None, width=None, height=None, colorFormat=None, status=None): |
| 455 | if self.shouldQuit: return |
| 456 | import spectacularAI |
| 457 | |
| 458 | output = { |
| 459 | "type": "vio", |
| 460 | "isTracking": status == spectacularAI.TrackingStatus.TRACKING, |
| 461 | "cameraPose" : cameraPose, |
| 462 | "image" : None, |
| 463 | "width" : self.targetResolution[0], |
| 464 | "height" : self.targetResolution[1], |
| 465 | "colorFormat" : None, |
| 466 | "time" : time.time() |
| 467 | } |
| 468 | if image is not None: |
| 469 | # Flip the image upside down for OpenGL. |
| 470 | if not self.args.flip: image = np.ascontiguousarray(np.flipud(image)) |
| 471 | output["image"] = image |
| 472 | output['width'] = width |
| 473 | output['height'] = height |
| 474 | output['colorFormat'] = colorFormat |
| 475 | self.vioOutputQueue.append(output) |
| 476 | |
| 477 | MAX_VIO_OUTPUT_QUEUE_SIZE = 25 |
| 478 | while len(self.vioOutputQueue) > MAX_VIO_OUTPUT_QUEUE_SIZE: |
| 479 | if self.args.targetFps == 0: |
| 480 | time.sleep(0.01) # Blocks replay, avoids dropping vio outputs |
| 481 | else: |
| 482 | self.vioOutputQueue.pop(0) |
| 483 | print("Warning: Dropping vio output in visualizer (processing too slow!)") |
| 484 | |
| 485 | # In live mode, future vio outputs are discarded |
| 486 | # In replay mode, Replay API is blocked -> no more vio outputs |
| 487 | while self.shouldPause: |
| 488 | time.sleep(0.01) |
| 489 | if self.shouldQuit: break |
| 490 | |
| 491 | def onMappingOutput(self, mapperOutput): |
| 492 | if self.shouldQuit: return |
no test coverage detected