This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the CMakeCache file. | |
# For build in directory: /home/guojianfei/ai_ws/direct-rtx-umesh-renderer/build | |
# It was generated by CMake: /home/guojianfei/anaconda3/envs/ml/bin/cmake | |
# You can edit this file to change values found and used by cmake. | |
# If you do not want to change any of the values, simply exit the editor. | |
# If you do want to change a value, simply edit, save, and exit the editor. | |
# The syntax for the file is as follows: | |
# KEY:TYPE=VALUE | |
# KEY is the name of a variable in the cache. | |
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Modified from https://github.com/kujason/ip_basic.git | |
Uses kornia tensor operations as pytorch alternatives for cv2 operations. | |
@inproceedings{ku2018defense, | |
title={In Defense of Classical Image Processing: Fast Depth Completion on the CPU}, | |
author={Ku, Jason and Harakeh, Ali and Waslander, Steven L}, | |
booktitle={2018 15th Conference on Computer and Robot Vision (CRV)}, | |
pages={16--22}, | |
year={2018}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ray_sphere_intersection_rough( | |
rays_o: torch.Tensor, rays_d: torch.Tensor, *, | |
r=1.0, keepdim=True, t_min_cons: float=0.0, t_max_cons: float=None) -> Tuple[torch.Tensor, torch.Tensor]: | |
""" | |
NOTE: Modified from https://github.com/Totoro97/NeuS | |
rays_o: camera center's coordinate | |
rays_d: camera rays' directions. already normalized. | |
""" | |
dir_scale = rays_d.norm(dim=-1, keepdim=keepdim).clamp_min_(1e-10) | |
# NOTE: (minus) the length of the line projected from [the line from camera to sphere center] to [the line of camera rays] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy | |
from scipy.spatial.transform import Rotation as R | |
np.set_printoptions(precision=4,suppress=True) | |
rot = R.random().as_matrix() | |
trans = np.random.uniform(size=(3,)) | |
c2w = np.eye(4) | |
c2w[:3,:3] = rot | |
c2w[:3,3] = trans |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without modification, are permitted | |
* provided that the following conditions are met: | |
* * Redistributions of source code must retain the above copyright notice, this list of | |
* conditions and the following disclaimer. | |
* * Redistributions in binary form must reproduce the above copyright notice, this list of | |
* conditions and the following disclaimer in the documentation and/or other materials | |
* provided with the distribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
from torch import autograd | |
from torch.optim import Adam | |
import torch.nn.functional as F | |
import tinycudann as tcnn | |
class SDF(nn.Module): | |
def __init__(self, hash=True, n_levels=12, log2_hashmap_size=15, base_resolution=16, smoothstep=False) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
camera extrinsics visualization tools | |
modified from https://github.com/opencv/opencv/blob/master/samples/python/camera_calibration_show_extrinsics.py | |
''' | |
from utils.print_fn import log | |
import numpy as np | |
import cv2 as cv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
from scipy.spatial.transform import Rotation as R | |
from scipy.interpolate import interp1d | |
# test = 'easy' | |
test = 'hard' | |
_intr3x3 = torch.tensor([[500,0,1000],[0,500,500],[0,0,1]]) | |
cam_intrinsic = torch.eye(4, dtype=torch.double) | |
cam_intrinsic[:3, :3] = _intr3x3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: 给定一个点,找到其在一个样条函数上的最近点(或者说,投影点) | |
import numpy as np, matplotlib.pyplot as pp, mpl_toolkits.mplot3d as mp | |
import scipy.interpolate as si, scipy.optimize as so, scipy.spatial.distance as ssd | |
data = (1,2,3,4,5,6,7,8),(1,2.5,4,5.5,6.5,8.5,10,12.5),(1,2.5,4.5,6.5,8,8.5,10,12.5) | |
p = 6.5,9.5,9 | |
# Fit a spline to the data - s is the amount of smoothing, tck is the parameters of the resulting spline | |
(tck, uu) = si.splprep(data, s=0) |