Remove file from remote
This commit is contained in:
@@ -1,277 +0,0 @@
|
||||
import numpy as np
|
||||
import os
|
||||
import torch
|
||||
from scipy.spatial.transform import Rotation as R
|
||||
import glob
|
||||
import argparse
|
||||
from PIL import Image
|
||||
|
||||
def rotation_matrix_to_quaternion(rot_matrix):
|
||||
"""Convert rotation matrix to quaternion (w, x, y, z)"""
|
||||
rotation = R.from_matrix(rot_matrix)
|
||||
return rotation.as_quat()[[3, 0, 1, 2]] # Reorder from (x, y, z, w) to (w, x, y, z)
|
||||
|
||||
def write_cameras_txt(intrinsics, image_shapes, output_dir):
|
||||
"""Write cameras.txt file"""
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
with open(os.path.join(output_dir, "cameras.txt"), "w") as f:
|
||||
f.write("# Camera list with one line of data per camera:\n")
|
||||
f.write("# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]\n")
|
||||
f.write(f"# Number of cameras: {len(intrinsics)}\n")
|
||||
|
||||
for i, (intrin, shape) in enumerate(zip(intrinsics, image_shapes)):
|
||||
# Extract image dimensions
|
||||
height, width = shape
|
||||
|
||||
# Extract focal length and principal point
|
||||
fx, fy = intrin[0, 0], intrin[1, 1]
|
||||
cx, cy = intrin[0, 2], intrin[1, 2]
|
||||
|
||||
# Using PINHOLE model (fx, fy, cx, cy)
|
||||
camera_id = i + 1
|
||||
f.write(f"{camera_id} PINHOLE {width} {height} {fx} {fy} {cx} {cy}\n")
|
||||
|
||||
def extract_sparse_point_cloud(point_maps, images, sample_step=20):
|
||||
"""Extract a sparse point cloud from point maps with colors from images"""
|
||||
points = []
|
||||
point_colors = [] # Will store actual colors from images
|
||||
point_origins = [] # Track which image/pixel each point came from
|
||||
|
||||
for img_idx, (point_map, img) in enumerate(zip(point_maps, images)):
|
||||
h, w, _ = point_map.shape
|
||||
for y in range(0, h, sample_step):
|
||||
for x in range(0, w, sample_step):
|
||||
# Get 3D point coordinates
|
||||
point3d = point_map[y, x]
|
||||
|
||||
# Skip invalid points
|
||||
if np.linalg.norm(point3d) < 0.001 or np.linalg.norm(point3d) > 1000:
|
||||
continue
|
||||
|
||||
# Extract the color from the image
|
||||
color = img[y, x]
|
||||
|
||||
# Add point, color, and origin info
|
||||
points.append(point3d)
|
||||
point_colors.append(color)
|
||||
point_origins.append((img_idx, y, x))
|
||||
|
||||
return np.array(points), np.array(point_colors), point_origins
|
||||
|
||||
def filter_points_by_distance(points, colors, origins, min_distance=0.05):
|
||||
"""Filter points that are too close to each other"""
|
||||
# if len(points) == 0:
|
||||
return points, colors, origins
|
||||
|
||||
def compute_point_visibility(points3d, extrinsics, intrinsics, image_shapes):
|
||||
"""Compute which images can see each 3D point"""
|
||||
num_points = len(points3d)
|
||||
num_images = len(extrinsics)
|
||||
|
||||
# For each image, store visible 2D projections
|
||||
image_points = [[] for _ in range(num_images)]
|
||||
|
||||
# For each 3D point, store which images see it
|
||||
point_tracks = [[] for _ in range(num_points)]
|
||||
|
||||
for point_idx, point3d in enumerate(points3d):
|
||||
for img_idx, (extrinsic, intrinsic, shape) in enumerate(zip(extrinsics, intrinsics, image_shapes)):
|
||||
# Get image dimensions
|
||||
height, width = shape
|
||||
|
||||
# Transform point to camera coordinates
|
||||
point_cam = np.dot(extrinsic[:3, :3], point3d) + extrinsic[:3, 3]
|
||||
|
||||
# Check if point is in front of camera
|
||||
if point_cam[2] <= 0:
|
||||
continue
|
||||
|
||||
# Project to image plane
|
||||
point_homo = np.dot(intrinsic, point_cam / point_cam[2])
|
||||
x, y = point_homo[0], point_homo[1]
|
||||
|
||||
# Check if within image boundaries
|
||||
if 0 <= x < width and 0 <= y < height:
|
||||
image_points[img_idx].append((x, y, point_idx))
|
||||
point_tracks[point_idx].append((img_idx + 1, len(image_points[img_idx]) - 1))
|
||||
|
||||
return image_points, point_tracks
|
||||
|
||||
def write_images_txt(extrinsics, image_points, image_names, output_dir):
|
||||
"""Write images.txt file"""
|
||||
with open(os.path.join(output_dir, "images.txt"), "w") as f:
|
||||
f.write("# Image list with two lines of data per image:\n")
|
||||
f.write("# IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME\n")
|
||||
f.write("# POINTS2D[] as (X, Y, POINT3D_ID)\n")
|
||||
f.write(f"# Number of images: {len(extrinsics)}\n")
|
||||
|
||||
for img_idx, (extrinsic, points) in enumerate(zip(extrinsics, image_points)):
|
||||
# Extract rotation matrix and translation vector
|
||||
rot_matrix = extrinsic[:3, :3]
|
||||
trans_vector = extrinsic[:3, 3]
|
||||
|
||||
# Convert to camera-to-world transformation
|
||||
rot_c2w = rot_matrix.T # Transpose for inverse rotation
|
||||
trans_c2w = -np.dot(rot_c2w, trans_vector) # -R^T * t
|
||||
|
||||
quat_c2w = rotation_matrix_to_quaternion(rot_c2w)
|
||||
|
||||
image_id = img_idx + 1
|
||||
camera_id = img_idx + 1 # Assuming one camera per image
|
||||
image_name = os.path.basename(image_names[img_idx])
|
||||
|
||||
# Write image pose
|
||||
f.write(f"{image_id} {quat_c2w[0]:.9f} {quat_c2w[1]:.9f} {quat_c2w[2]:.9f} {quat_c2w[3]:.9f} {trans_c2w[0]:.9f} {trans_c2w[1]:.9f} {trans_c2w[2]:.9f} {camera_id} {image_name}\n")
|
||||
|
||||
# Write 2D point observations
|
||||
points2d_line = " ".join([f"{x:.6f} {y:.6f} {point3d_id}" for x, y, point3d_id in points])
|
||||
f.write(f"{points2d_line}\n")
|
||||
|
||||
def write_points3d_txt(points3d, point_colors, point_tracks, output_dir):
|
||||
"""Write points3D.txt file"""
|
||||
with open(os.path.join(output_dir, "points3D.txt"), "w") as f:
|
||||
f.write("# 3D point list with one line of data per point:\n")
|
||||
f.write("# POINT3D_ID, X, Y, Z, R, G, B, ERROR, TRACK[] as (IMAGE_ID, POINT2D_IDX)\n")
|
||||
f.write(f"# Number of points: {len(points3d)}\n")
|
||||
|
||||
valid_points = 0
|
||||
for point_idx, (point3d, color, track) in enumerate(zip(points3d, point_colors, point_tracks)):
|
||||
# Skip points that aren't visible in any image
|
||||
if not track:
|
||||
continue
|
||||
|
||||
# Convert color to integers
|
||||
r, g, b = [int(c * 255) for c in color]
|
||||
error = 1.0 # Placeholder for reprojection error
|
||||
|
||||
# Format track information
|
||||
track_str = " ".join([f"{img_id} {point2d_idx}" for img_id, point2d_idx in track])
|
||||
|
||||
# Write point information
|
||||
f.write(f"{point_idx} {point3d[0]:.9f} {point3d[1]:.9f} {point3d[2]:.9f} {r} {g} {b} {error:.9f} {track_str}\n")
|
||||
valid_points += 1
|
||||
|
||||
print(f"Written {valid_points} valid points (visible in at least one image)")
|
||||
|
||||
def convert_to_colmap_format(extrinsics, intrinsics, point_maps, image_paths, output_dir, image_shapes, images):
|
||||
"""Convert model estimates to COLMAP format files"""
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# Extract sparse point cloud with colors from images
|
||||
print("Extracting colored sparse point cloud...")
|
||||
points3d, point_colors, point_origins = extract_sparse_point_cloud(point_maps, images, sample_step=20)
|
||||
print(f"Extracted {len(points3d)} colored points")
|
||||
|
||||
# Compute point visibility in each image
|
||||
print("Computing point visibility...")
|
||||
image_points, point_tracks = compute_point_visibility(
|
||||
points3d, extrinsics, intrinsics, image_shapes
|
||||
)
|
||||
|
||||
# Write COLMAP files
|
||||
print("Writing COLMAP format files...")
|
||||
write_cameras_txt(intrinsics, image_shapes, output_dir)
|
||||
write_images_txt(extrinsics, image_points, image_paths, output_dir)
|
||||
write_points3d_txt(points3d, point_colors, point_tracks, output_dir)
|
||||
|
||||
print(f"COLMAP format files written to {output_dir}")
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Convert VGGT estimates to COLMAP format")
|
||||
parser.add_argument("image_dir", help="Directory containing input images")
|
||||
parser.add_argument("output_dir", help="Directory to write COLMAP files")
|
||||
parser.add_argument("--sample-step", type=int, default=10, help="Point sampling step (lower = denser point cloud)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Get list of images
|
||||
image_paths = sorted(glob.glob(os.path.join(args.image_dir, "*.jpg"))) + \
|
||||
sorted(glob.glob(os.path.join(args.image_dir, "*.png")))
|
||||
|
||||
if not image_paths:
|
||||
raise ValueError(f"No images found in {args.image_dir}")
|
||||
|
||||
print(f"Found {len(image_paths)} images")
|
||||
|
||||
# Process images with VGGT model
|
||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||
dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
||||
|
||||
print(f"Using device: {device}")
|
||||
print("Loading VGGT model...")
|
||||
|
||||
from vggt.models.vggt import VGGT
|
||||
from vggt.utils.load_fn import load_and_preprocess_images
|
||||
from vggt.utils.pose_enc import pose_encoding_to_extri_intri
|
||||
from vggt.utils.geometry import unproject_depth_map_to_point_map
|
||||
|
||||
model = VGGT.from_pretrained("facebook/VGGT-1B").to(device)
|
||||
|
||||
print("Processing images...")
|
||||
images_tensor = load_and_preprocess_images(image_paths).to(device)
|
||||
|
||||
# Also load images in RGB format for coloring
|
||||
original_images = []
|
||||
image_shapes = []
|
||||
for img_path in image_paths:
|
||||
with Image.open(img_path) as img:
|
||||
# Convert to RGB and numpy array for coloring purposes
|
||||
np_img = np.array(img.convert('RGB')) / 255.0 # Normalize to 0-1
|
||||
original_images.append(np_img)
|
||||
# Store image shape
|
||||
image_shapes.append((img.height, img.width))
|
||||
|
||||
with torch.no_grad():
|
||||
with torch.cuda.amp.autocast(dtype=dtype):
|
||||
images_batch = images_tensor[None] # add batch dimension
|
||||
aggregated_tokens_list, ps_idx = model.aggregator(images_batch)
|
||||
|
||||
print("Estimating camera parameters...")
|
||||
pose_enc = model.camera_head(aggregated_tokens_list)[-1]
|
||||
extrinsic, intrinsic = pose_encoding_to_extri_intri(pose_enc, images_batch.shape[-2:])
|
||||
|
||||
print("Estimating depth maps...")
|
||||
depth_map, _ = model.depth_head(aggregated_tokens_list, images_batch, ps_idx)
|
||||
|
||||
print("Unprojecting to 3D points...")
|
||||
point_map = unproject_depth_map_to_point_map(
|
||||
depth_map.squeeze(0), extrinsic.squeeze(0), intrinsic.squeeze(0)
|
||||
)
|
||||
|
||||
# Convert to numpy arrays if they're not already
|
||||
if isinstance(extrinsic, torch.Tensor):
|
||||
extrinsic_np = extrinsic.squeeze(0).cpu().numpy()
|
||||
else:
|
||||
extrinsic_np = extrinsic
|
||||
|
||||
if isinstance(intrinsic, torch.Tensor):
|
||||
intrinsic_np = intrinsic.squeeze(0).cpu().numpy()
|
||||
else:
|
||||
intrinsic_np = intrinsic
|
||||
|
||||
if isinstance(point_map, torch.Tensor):
|
||||
point_map_np = point_map.cpu().numpy()
|
||||
else:
|
||||
point_map_np = point_map
|
||||
|
||||
# Resize original images to match point map if needed
|
||||
resized_images = []
|
||||
for i, img in enumerate(original_images):
|
||||
h, w, _ = point_map_np[i].shape
|
||||
if img.shape[0] != h or img.shape[1] != w:
|
||||
# Use simple resizing - could be improved with better interpolation
|
||||
from skimage.transform import resize
|
||||
resized_img = resize(img, (h, w, 3), anti_aliasing=True)
|
||||
resized_images.append(resized_img)
|
||||
else:
|
||||
resized_images.append(img)
|
||||
|
||||
# Convert to COLMAP format
|
||||
convert_to_colmap_format(
|
||||
extrinsic_np, intrinsic_np, point_map_np, image_paths,
|
||||
args.output_dir, image_shapes, resized_images
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
-259
@@ -1,259 +0,0 @@
|
||||
Initializing and loading VGGT model...
|
||||
Initializing and loading VGGT model...
|
||||
Files copied to input_images_20250318_113826_158596/images; took 0.213 seconds
|
||||
Images for reconstruction:
|
||||
input_images_20250318_113826_158596/images/sandalye1.jpg
|
||||
input_images_20250318_113826_158596/images/sandalye2.jpg
|
||||
input_images_20250318_113826_158596/images/sandalye3.jpg
|
||||
input_images_20250318_113826_158596/images/sandalye4.jpg
|
||||
Running run_model...
|
||||
Processing images from input_images_20250318_113826_158596
|
||||
Found 4 images
|
||||
Preprocessed images shape: torch.Size([4, 3, 518, 518])
|
||||
Running inference...
|
||||
Converting pose encoding to extrinsic and intrinsic matrices...
|
||||
extrinsic.shape torch.Size([1, 4, 3, 4])
|
||||
|
||||
extrinsic tensor([[[[ 1.0000e+00, 3.9872e-05, 2.8053e-04, -3.3790e-05],
|
||||
[-3.9849e-05, 1.0000e+00, -8.0769e-05, 1.1223e-05],
|
||||
[-2.8053e-04, 8.0758e-05, 1.0000e+00, -1.1633e-04]],
|
||||
|
||||
[[ 8.7897e-01, -1.3935e-01, 4.5607e-01, -4.3532e-01],
|
||||
[ 1.3684e-01, 9.8984e-01, 3.8704e-02, -2.3849e-02],
|
||||
[-4.5683e-01, 2.8389e-02, 8.8910e-01, 1.1196e-01]],
|
||||
|
||||
[[ 5.4024e-01, 2.4198e-01, -8.0597e-01, 7.7377e-01],
|
||||
[-2.4684e-01, 9.6120e-01, 1.2313e-01, -1.2373e-01],
|
||||
[ 8.0450e-01, 1.3242e-01, 5.7901e-01, 4.3251e-01]],
|
||||
|
||||
[[-8.7065e-01, 1.3212e-01, -4.7383e-01, 4.1820e-01],
|
||||
[-1.6372e-01, 8.3051e-01, 5.3240e-01, -5.3343e-01],
|
||||
[ 4.6386e-01, 5.4111e-01, -7.0145e-01, 1.6244e+00]]]],
|
||||
device='cuda:0')
|
||||
extrinsic.shape torch.Size([1, 4, 3, 3])
|
||||
|
||||
intrinsic tensor([[[[635.5547, 0.0000, 259.0000],
|
||||
[ 0.0000, 632.4077, 259.0000],
|
||||
[ 0.0000, 0.0000, 1.0000]],
|
||||
|
||||
[[673.3128, 0.0000, 259.0000],
|
||||
[ 0.0000, 668.9824, 259.0000],
|
||||
[ 0.0000, 0.0000, 1.0000]],
|
||||
|
||||
[[647.9485, 0.0000, 259.0000],
|
||||
[ 0.0000, 645.5082, 259.0000],
|
||||
[ 0.0000, 0.0000, 1.0000]],
|
||||
|
||||
[[657.2827, 0.0000, 259.0000],
|
||||
[ 0.0000, 654.9764, 259.0000],
|
||||
[ 0.0000, 0.0000, 1.0000]]]], device='cuda:0')
|
||||
Computing world points from depth map...
|
||||
(4, 518, 518, 3)
|
||||
[[[[-0.32635777 -0.3277628 0.80045778]
|
||||
[-0.32256861 -0.32521258 0.79423084]
|
||||
[-0.32393473 -0.32785957 0.80069504]
|
||||
...
|
||||
[ 0.3017545 -0.30691559 0.74978018]
|
||||
[ 0.29972646 -0.30366574 0.74184234]
|
||||
[ 0.29839372 -0.30114284 0.73568019]]
|
||||
|
||||
[[-0.31818604 -0.31832302 0.78041975]
|
||||
[-0.3173857 -0.31875226 0.78147245]
|
||||
[-0.31967265 -0.32229703 0.79016251]
|
||||
...
|
||||
[ 0.30374933 -0.30775166 0.75473664]
|
||||
[ 0.30392252 -0.3067282 0.75222743]
|
||||
[ 0.29965597 -0.30124899 0.73879209]]
|
||||
|
||||
[[-0.31972387 -0.3186213 0.78419041]
|
||||
[-0.32490816 -0.32504109 0.79998947]
|
||||
[-0.32480285 -0.32619915 0.80283983]
|
||||
...
|
||||
[ 0.30304874 -0.30585151 0.75299595]
|
||||
[ 0.30336437 -0.30497799 0.75084603]
|
||||
[ 0.2993832 -0.29980799 0.73811962]]
|
||||
|
||||
...
|
||||
|
||||
[[-0.33901007 0.33658178 0.83136156]
|
||||
[-0.32582639 0.32474639 0.80213335]
|
||||
[-0.31179238 0.31196827 0.77057688]
|
||||
...
|
||||
[ 0.30756927 0.30935648 0.7642391 ]
|
||||
[ 0.29614456 0.29670384 0.73298793]
|
||||
[ 0.27577959 0.27522561 0.67993796]]
|
||||
|
||||
[[-0.34688456 0.34574441 0.85066747]
|
||||
[-0.35423694 0.35443977 0.87205807]
|
||||
[-0.33679196 0.33829626 0.83234564]
|
||||
...
|
||||
[ 0.2973025 0.30019644 0.73872963]
|
||||
[ 0.2851795 0.28683233 0.70584956]
|
||||
[ 0.26956483 0.27007303 0.66461615]]
|
||||
|
||||
[[-0.34381086 0.34401416 0.84313129]
|
||||
[-0.34717483 0.34872546 0.85467628]
|
||||
[-0.34365569 0.34653311 0.84930432]
|
||||
...
|
||||
[ 0.28845039 0.29238992 0.71673515]
|
||||
[ 0.29376423 0.29661765 0.72709672]
|
||||
[ 0.29365914 0.29536141 0.72401809]]]
|
||||
|
||||
|
||||
[[[-0.27946509 -0.29477718 0.69031692]
|
||||
[-0.26531197 -0.29030559 0.68010908]
|
||||
[-0.26449681 -0.29057286 0.68089283]
|
||||
...
|
||||
[ 0.30653217 -0.34329744 0.87838063]
|
||||
[ 0.30861049 -0.34085725 0.87222004]
|
||||
[ 0.31028803 -0.33932096 0.86838007]]
|
||||
|
||||
[[-0.2688719 -0.28984225 0.68177667]
|
||||
[-0.25869788 -0.28679426 0.67483183]
|
||||
[-0.24405615 -0.28214502 0.6641481 ]
|
||||
...
|
||||
[ 0.30616927 -0.34339063 0.88149869]
|
||||
[ 0.30734013 -0.34308526 0.8808186 ]
|
||||
[ 0.31049251 -0.33810836 0.86809097]]
|
||||
|
||||
[[-0.25766528 -0.28472603 0.67272506]
|
||||
[-0.2610214 -0.28645689 0.67693901]
|
||||
[-0.25939894 -0.28643477 0.67704571]
|
||||
...
|
||||
[ 0.30660648 -0.34162906 0.87984014]
|
||||
[ 0.30754778 -0.34185431 0.88052861]
|
||||
[ 0.31080704 -0.33663796 0.86713213]]
|
||||
|
||||
...
|
||||
|
||||
[[-0.26050822 0.39260375 0.78422529]
|
||||
[-0.23273498 0.37591514 0.75874836]
|
||||
[-0.19342003 0.35200265 0.72174699]
|
||||
...
|
||||
[ 0.3749378 0.27278311 1.05199034]
|
||||
[ 0.37321451 0.28736655 1.09755724]
|
||||
[ 0.37564739 0.28077125 1.07865886]]
|
||||
|
||||
[[-0.26893818 0.39936239 0.79274108]
|
||||
[-0.27326109 0.40263491 0.79886063]
|
||||
[-0.24693766 0.38678373 0.7747721 ]
|
||||
...
|
||||
[ 0.3755698 0.27180026 1.0451034 ]
|
||||
[ 0.37722163 0.26900011 1.03775596]
|
||||
[ 0.38097745 0.25502119 0.99644519]]
|
||||
|
||||
[[-0.23415218 0.37915543 0.75883711]
|
||||
[-0.25543611 0.39302342 0.78156286]
|
||||
[-0.244081 0.38648061 0.77219268]
|
||||
...
|
||||
[ 0.38006765 0.25102234 0.97855636]
|
||||
[ 0.38073792 0.25290644 0.9853092 ]
|
||||
[ 0.38054548 0.25944408 1.00614963]]]
|
||||
|
||||
|
||||
[[[-0.23509424 -0.41133813 1.08391587]
|
||||
[-0.2495936 -0.40332443 1.06414579]
|
||||
[-0.24803409 -0.4034823 1.06426301]
|
||||
...
|
||||
[ 0.01272387 -0.23979517 0.54143505]
|
||||
[ 0.01129287 -0.23923831 0.5401517 ]
|
||||
[ 0.02229242 -0.24042661 0.54119231]]
|
||||
|
||||
[[-0.25275668 -0.40132411 1.06256198]
|
||||
[-0.26313683 -0.39544312 1.04792776]
|
||||
[-0.25849008 -0.39717296 1.05189651]
|
||||
...
|
||||
[ 0.01571067 -0.23917281 0.54219104]
|
||||
[ 0.01542839 -0.23877725 0.54111911]
|
||||
[-0.00361067 -0.23577585 0.53654601]]
|
||||
|
||||
[[-0.26319948 -0.39502293 1.05013188]
|
||||
[-0.2504369 -0.40083964 1.0641572 ]
|
||||
[-0.25789636 -0.39645873 1.05314673]
|
||||
...
|
||||
[ 0.00777232 -0.23702825 0.54087802]
|
||||
[ 0.00771979 -0.23666892 0.53985876]
|
||||
[-0.01090445 -0.23375314 0.53536792]]
|
||||
|
||||
...
|
||||
|
||||
[[-0.17039119 0.40640899 1.60073241]
|
||||
[-0.19096508 0.3885153 1.55737619]
|
||||
[-0.19465709 0.38497204 1.54676109]
|
||||
...
|
||||
[-0.02004279 0.38856792 0.6495685 ]
|
||||
[ 0.0340838 0.42424778 0.66639606]
|
||||
[ 0.03972201 0.4278182 0.66690115]]
|
||||
|
||||
[[-0.15641601 0.42065152 1.62900647]
|
||||
[-0.18368865 0.39695608 1.57258144]
|
||||
[-0.19292603 0.38866549 1.55122962]
|
||||
...
|
||||
[-0.03154959 0.38239768 0.64596448]
|
||||
[-0.0069916 0.39855119 0.65292407]
|
||||
[-0.0308108 0.38258874 0.64367914]]
|
||||
|
||||
[[-0.19888478 0.38662463 1.54783547]
|
||||
[-0.19650977 0.38824308 1.5489444 ]
|
||||
[-0.22517428 0.3632996 1.49018289]
|
||||
...
|
||||
[-0.0785455 0.35255071 0.63039331]
|
||||
[-0.05018382 0.371291 0.63871399]
|
||||
[-0.04201678 0.37657947 0.64020454]]]
|
||||
|
||||
|
||||
[[[ 0.24408485 -0.35839285 1.02185841]
|
||||
[ 0.22540079 -0.36147691 1.03593353]
|
||||
[ 0.22383672 -0.36140655 1.03576627]
|
||||
...
|
||||
[-0.33928249 -0.29961887 0.82623133]
|
||||
[-0.33998192 -0.29910583 0.82418417]
|
||||
[-0.33834201 -0.29527485 0.80836729]]
|
||||
|
||||
[[ 0.22273443 -0.36127259 1.04010822]
|
||||
[ 0.21128833 -0.36304563 1.04818302]
|
||||
[ 0.21446391 -0.36209773 1.04408448]
|
||||
...
|
||||
[-0.33926179 -0.29841579 0.8256513 ]
|
||||
[-0.33948677 -0.29722773 0.82082631]
|
||||
[-0.34343427 -0.30132617 0.83782139]]
|
||||
|
||||
[[ 0.2181925 -0.36106792 1.04436677]
|
||||
[ 0.22282258 -0.35983951 1.03905615]
|
||||
[ 0.22128324 -0.35976713 1.03887214]
|
||||
...
|
||||
[-0.34051235 -0.29900312 0.83243455]
|
||||
[-0.34124158 -0.29853749 0.83059836]
|
||||
[-0.34494142 -0.30232457 0.8462184 ]]
|
||||
|
||||
...
|
||||
|
||||
[[ 0.71527314 0.81422378 1.12961781]
|
||||
[ 0.63372771 0.72739113 1.16137676]
|
||||
[ 0.63649916 0.73292072 1.15831854]
|
||||
...
|
||||
[-0.36567945 1.18487171 0.38276409]
|
||||
[-0.36379322 1.25170052 0.33228194]
|
||||
[-0.3619157 1.32145128 0.27955365]]
|
||||
|
||||
[[ 0.75121778 0.85613816 1.11595538]
|
||||
[ 0.69141656 0.79312866 1.13858521]
|
||||
[ 0.63250065 0.73083639 1.161045 ]
|
||||
...
|
||||
[-0.36201864 1.24967404 0.33818433]
|
||||
[-0.36173734 1.29338213 0.30484941]
|
||||
[-0.36453465 1.29021636 0.30607512]]
|
||||
|
||||
[[ 0.64923229 0.74657437 1.15902805]
|
||||
[ 0.68824982 0.79207206 1.14100994]
|
||||
[ 0.63004851 0.73044378 1.163124 ]
|
||||
...
|
||||
[-0.35799937 1.32063673 0.28931232]
|
||||
[-0.36057686 1.32153301 0.28752395]
|
||||
[-0.37615691 1.11483374 0.43864225]]]]
|
||||
Building GLB scene
|
||||
Using Depthmap and Camera Branch
|
||||
GLB Scene built
|
||||
Total time: 2.53 seconds
|
||||
Reconstruction successful. Processed 4 frames.
|
||||
Output GLB file saved at: input_images_20250318_113826_158596/glbscene_50.0AllmaskbFalsemaskwFalse_camFalse_skyFalse_predDepthmapandCameraBranch.glb
|
||||
-1118
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
import pandas as pd
|
||||
|
||||
def subtract_consecutive_rows(csv_file, output_file):
|
||||
# Read the csv file into a DataFrame
|
||||
df = pd.read_csv(csv_file)
|
||||
|
||||
# Check if the DataFrame has at least two rows
|
||||
if len(df) < 2:
|
||||
print("The CSV file must have at least two rows.")
|
||||
return
|
||||
|
||||
# Subtract consecutive rows
|
||||
result_df = df.diff().iloc[1:]
|
||||
|
||||
# Save the result to a new CSV file
|
||||
result_df.to_csv(output_file, index=False)
|
||||
print(f"Result saved to {output_file}")
|
||||
|
||||
# Example usage
|
||||
csv_file_path = 'camera_poses2.csv'
|
||||
output_file_path = 'camera_poses_sub2.csv'
|
||||
subtract_consecutive_rows(csv_file_path, output_file_path)
|
||||
Reference in New Issue
Block a user