IcyFeather commited on
Commit
da1bf32
·
1 Parent(s): cbbe7c4

add examples

Browse files
.gitignore CHANGED
@@ -1 +1,2 @@
1
- flagged/
 
 
1
+ flagged/
2
+ *.ply
app.py CHANGED
@@ -15,7 +15,7 @@ def generate(front_view: gr.Image, seed=-1):
15
  # print(os.path.join("examples", f'{origin_file}.ply'))
16
  # 随机延时
17
  time.sleep(delay)
18
- return os.path.join("examples", f'processed_{origin_file}.obj')
19
  # return "./examples/processed_xxy_v2.obj"
20
 
21
  def get_png_paths(directory='examples'):
 
15
  # print(os.path.join("examples", f'{origin_file}.ply'))
16
  # 随机延时
17
  time.sleep(delay)
18
+ return os.path.join("examples", f'{origin_file}.obj')
19
  # return "./examples/processed_xxy_v2.obj"
20
 
21
  def get_png_paths(directory='examples'):
examples/1066.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa0efe9cb41f385ddaeceeaa6e8d62e326fcc1a2aa290a60ef35f314b4baedec
3
+ size 6835014
examples/1066.png ADDED
examples/1077.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a26b39b57d2c2d29c8d1a24131c1dcd315972619d06f161b36b753364bb73781
3
+ size 6887394
examples/1077.png ADDED
examples/1110.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e407fb5df462fb0e62c276166286866304a5194d55d4e47cf7635ffc6bea071
3
+ size 6842386
examples/1110.png ADDED
examples/{processed_xxy_v2.obj → xxy_v2.obj} RENAMED
File without changes
test.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import trimesh
2
+ import numpy as np
3
+
4
+ def ply_to_obj(ply_path, obj_path):
5
+ mesh = trimesh.load(ply_path)
6
+
7
+ # 定义旋转矩阵
8
+ rotation_matrix = np.array([
9
+ [-1, 0, 0, 0],
10
+ [0, 1, 0, 0],
11
+ [0, 0, -1, 0],
12
+ [0, 0, 0, -1]
13
+ ])
14
+
15
+ # 应用旋转矩阵
16
+ mesh.apply_transform(rotation_matrix)
17
+
18
+ mesh.export(obj_path)
19
+
20
+
21
+ ply_path = "examples/1110.ply"
22
+ obj_path = "examples/1110.obj"
23
+
24
+ ply_to_obj(ply_path, obj_path)
25
+
26
+ # import trimesh
27
+ # import numpy as np
28
+
29
+ # def rotate_obj_180_xy(obj_path, output_path):
30
+ # # 加载OBJ文件
31
+ # mesh = trimesh.load(obj_path)
32
+
33
+ # # 定义旋转矩阵
34
+ # rotation_matrix = np.array([
35
+ # [-1, 0, 0, 0],
36
+ # [0, 1, 0, 0],
37
+ # [0, 0, -1, 0],
38
+ # [0, 0, 0, -1]
39
+ # ])
40
+
41
+ # # 应用旋转矩阵
42
+ # mesh.apply_transform(rotation_matrix)
43
+
44
+ # # 导出旋转后的OBJ文件
45
+ # mesh.export(output_path)
46
+
47
+ # obj_path = "examples/1110.obj"
48
+ # output_path = "examples/processed_1110.obj"
49
+
50
+ # rotate_obj_180_xy(obj_path, output_path)