Skip to content

Commit 77a15e8

Browse files
0.0.0
0 parents  commit 77a15e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+6346
-0
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
test_data/benchmarking/copyroom_000010.pcd filter=lfs diff=lfs merge=lfs -text
2+
test_data/benchmarking/lounge_000641.pcd filter=lfs diff=lfs merge=lfs -text
3+
test_data/benchmarking/stonewall_000381.pcd filter=lfs diff=lfs merge=lfs -text
4+
test_data/benchmarking/lounge_model_000641.pkl filter=lfs diff=lfs merge=lfs -text
5+
test_data/benchmarking/stonewall_model_000381.pkl filter=lfs diff=lfs merge=lfs -text
6+
test_data/benchmarking/copyroom_model_000010.pkl filter=lfs diff=lfs merge=lfs -text
7+
test_data/FitSmallDim2/resp_ref.csv filter=lfs diff=lfs merge=lfs -text
8+
test_data/FitSmallDim2/weights.csv filter=lfs diff=lfs merge=lfs -text
9+
test_data/FitSmallDim2/covariances.csv filter=lfs diff=lfs merge=lfs -text
10+
test_data/FitSmallDim2/data.csv filter=lfs diff=lfs merge=lfs -text
11+
test_data/FitSmallDim2/means.csv filter=lfs diff=lfs merge=lfs -text
12+
test_data/FitSmallDim2/precisions_cholesky.csv filter=lfs diff=lfs merge=lfs -text
13+
test_data/kinit/center_id.txt filter=lfs diff=lfs merge=lfs -text
14+
test_data/kinit/rand_vals.txt filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__pycache__/
2+
*.pyc
3+
*.pkl
4+
*.tex
5+
*.png
6+
.DS_Store
7+
*.ot
8+
html/
9+
*.pcd

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2023, Kshitij Goel, Wennie Tabib
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python Wrapper for SOGMM
2+
3+
Please see the meta-package https://github.com/gira3d/gira3d-reconstruction for detailed documentation.

benchmarking_scripts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Scripts used for benchmarking SOGMM against existing methods.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import os
2+
import pathlib
3+
import argparse
4+
import glob
5+
import numpy as np
6+
from termcolor import cprint
7+
import open3d as o3d
8+
9+
from sogmm_py.sogmm import SOGMM
10+
from sogmm_py.utils import ImageUtils, read_log_trajectory, np_to_o3d
11+
12+
if __name__ == "__main__":
13+
parser = argparse.ArgumentParser(description="mean shift approach py")
14+
parser.add_argument('--datasetname', type=str)
15+
parser.add_argument('--datasetroot', type=str)
16+
parser.add_argument('--resultsroot', type=str)
17+
parser.add_argument('--decimate', type=int)
18+
parser.add_argument('--frames', nargs='+', type=int)
19+
parser.add_argument('--tikz', type=bool)
20+
21+
args = parser.parse_args()
22+
23+
decimate_factor = args.decimate
24+
datasets_root = args.datasetroot
25+
dataset_name = args.datasetname
26+
results_root = args.resultsroot
27+
28+
bandwidths = np.linspace(0.01, 0.05, 10)
29+
cprint(bandwidths, 'red')
30+
31+
K = np.eye(3)
32+
K[0, 0] = 525.0/decimate_factor
33+
K[1, 1] = 525.0/decimate_factor
34+
K[0, 2] = 319.5/decimate_factor
35+
K[1, 2] = 239.5/decimate_factor
36+
37+
W = (int)(640/decimate_factor)
38+
H = (int)(480/decimate_factor)
39+
40+
iu = ImageUtils(K)
41+
42+
rgb_glob_string = os.path.join(
43+
datasets_root, dataset_name + '-color/*.jpg')
44+
cprint('rgb glob string %s' % (rgb_glob_string), 'green')
45+
depth_glob_string = os.path.join(
46+
datasets_root, dataset_name + '-depth/*.png')
47+
cprint('depth glob string %s' % (depth_glob_string), 'green')
48+
traj_string = os.path.join(datasets_root, dataset_name + '-traj.log')
49+
cprint('traj path %s' % (traj_string), 'green')
50+
51+
rgb_paths = sorted(glob.glob(rgb_glob_string))
52+
depth_paths = sorted(glob.glob(depth_glob_string))
53+
traj = read_log_trajectory(traj_string)
54+
55+
for i, fr in enumerate(args.frames):
56+
cprint('processing frame %s in dataset %s' % (fr, args.datasetname), 'grey')
57+
58+
for b in bandwidths:
59+
results_path = os.path.join(results_root, dataset_name + '_sogmm/' + dataset_name + '_' + str(b))
60+
61+
local_pcd_path = os.path.join(results_path, 'local_pcd_' + str(fr) + '.pcd')
62+
pcld_gt, _ = iu.generate_pcld_wf(traj[fr].pose, rgb_path=rgb_paths[fr],
63+
depth_path=depth_paths[fr],
64+
size=(W, H))
65+
pathlib.Path(results_path).mkdir(parents=True, exist_ok=True)
66+
67+
sg = SOGMM(b)
68+
local_model_path = os.path.join(results_path, 'local_model_' + str(fr) + '.pkl')
69+
local_model = sg.fit(pcld_gt)
70+
sg.pickle_local_model(local_model, local_model_path)
71+
o3d.io.write_point_cloud(local_pcd_path, np_to_o3d(pcld_gt))

0 commit comments

Comments
 (0)