(output)
| 437 | return merged_df |
| 438 | |
| 439 | def process_mapping_output(output): |
| 440 | nonlocal savedKeyFrames |
| 441 | nonlocal pointClouds |
| 442 | nonlocal sparsePointColors |
| 443 | nonlocal blurScores |
| 444 | nonlocal frameWidth |
| 445 | nonlocal frameHeight |
| 446 | nonlocal intrinsics |
| 447 | nonlocal visualizer |
| 448 | nonlocal useMono |
| 449 | nonlocal finalMapWritten |
| 450 | |
| 451 | if visualizer is not None: |
| 452 | visualizer.onMappingOutput(output) |
| 453 | |
| 454 | saveImages = True |
| 455 | if args.format in PC_AND_MESH_FORMATS: |
| 456 | saveImages = False |
| 457 | if output.finalMap: finalMapWritten = True |
| 458 | return |
| 459 | |
| 460 | if not output.finalMap: |
| 461 | # New frames, let's save the images to disk |
| 462 | for frameId in output.updatedKeyFrames: |
| 463 | keyFrame = output.map.keyFrames.get(frameId) |
| 464 | if not keyFrame or savedKeyFrames.get(frameId): |
| 465 | continue |
| 466 | savedKeyFrames[frameId] = True |
| 467 | frameSet = keyFrame.frameSet |
| 468 | targetFrame = frameSet.rgbFrame |
| 469 | if not targetFrame: targetFrame = frameSet.primaryFrame |
| 470 | if not targetFrame or not targetFrame.image: continue |
| 471 | |
| 472 | if keyFrame.pointCloud: |
| 473 | pointClouds[frameId] = ( |
| 474 | np.copy(keyFrame.pointCloud.getPositionData()), |
| 475 | np.copy(keyFrame.pointCloud.getRGB24Data())) |
| 476 | |
| 477 | if frameWidth < 0: |
| 478 | frameWidth = targetFrame.image.getWidth() |
| 479 | frameHeight = targetFrame.image.getHeight() |
| 480 | |
| 481 | frameSet = keyFrame.frameSet |
| 482 | if args.no_undistort: |
| 483 | undistortedFrame = targetFrame |
| 484 | else: |
| 485 | undistortedFrame = frameSet.getUndistortedFrame(targetFrame) |
| 486 | if intrinsics is None: intrinsics = undistortedFrame.cameraPose.camera.getIntrinsicMatrix() |
| 487 | img = undistortedFrame.image.toArray() |
| 488 | |
| 489 | bgrImage = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) |
| 490 | if saveImages: |
| 491 | fileName = f"{tmp_dir}/frame_{frameId:05}.{args.image_format}" |
| 492 | cv2.imwrite(fileName, bgrImage) |
| 493 | |
| 494 | # Find colors for sparse features |
| 495 | SHOW_FEATURE_MARKERS = True |
| 496 | SHOW_MOTION_BLUR = False |
no test coverage detected