-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
159 lines (136 loc) · 5.69 KB
/
index.html
File metadata and controls
159 lines (136 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Interactive SegMesh3</title>
<link rel="stylesheet" href="/styles.css" />
</head>
<body>
<div id="app">
<main class="content">
<section class="viewport">
<canvas id="c"></canvas>
</section>
<aside class="panel">
<div class="toolbar">
<div class="title">Interactive SegMesh3</div>
<label class="btn full">
Import File (Multi-file supported)
<input id="fileInput" type="file" multiple />
</label>
</div>
<!-- <div class="panel-section">
<div class="panel-title">camera</div>
<div id="cameraParams" class="info">
<div><strong>extrisic (4x4):</strong><pre id="extrinsicMatrix"></pre></div>
<div><strong>intrinsic:</strong><pre id="intrinsicMatrix"></pre></div>
</div>
</div> -->
<div class="panel-section">
<div class="panel-title">Selected Object</div>
<div id="selectedInfo" class="info">None</div>
</div>
<div class="panel-section">
<div class="panel-title">Transformation</div>
<div class="row">
<button id="btnTranslate" class="btn small">Move (W)</button>
<button id="btnRotate" class="btn small">Rotate (E)</button>
<button id="btnScale" class="btn small">Scale (R)</button>
</div>
<div class="row">
<button id="btnDuplicate" class="btn small">Duplicate (Ctrl+D)</button>
<button id="btnDelete" class="btn small danger">Delete (Del)</button>
</div>
<div class="row">
<button id="btnFrame" class="btn small">Focus on</button>
<button id="btnReset" class="btn small">Reset</button>
</div>
</div>
<div class="panel-section">
<div class="panel-title">Backend Log</div>
<pre id="backendLog" class="log">(Empty)</pre>
</div>
<div class="panel-section">
<div class="panel-title">Scene</div>
<div class="row">
<label class="checkbox">
<input id="chkGrid" type="checkbox" checked />
Show Grid Lines
</label>
</div>
<div class="row">
<label class="checkbox">
<input id="chkWire" type="checkbox" />
Wireframe View
</label>
</div>
</div>
<div class="panel-section">
<div class="panel-title">Object List</div>
<div id="meshList" class="list"></div>
</div>
<div class="panel-section">
<div class="panel-title">Segmentation</div>
<div class="row">
<button id="btnUseViewpoint" class="btn small">View annotating</button>
<button id="btnMultiViewMerge" class="btn small primary">Merge to 3D</button>
</div>
<label class="checkbox">
<input id="chkUseHolopart" type="checkbox" />
Auto Fill (testing)
</label>
<div id="sceneList" class="list"></div>
</div>
</aside>
</main>
</div>
<div id="popup" class="popup">
<div class="popup-content">
<button id="closePopup">X</button>
<div class="canvas-wrapper" style="position: relative; width: 512px; height: 512px; background: #000;">
<img id="segBaseImage" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1;" />
<canvas id="segCanvas" width="512" height="512" style="position: absolute; top: 0; left: 0; z-index: 2;"></canvas>
</div>
<div>
<button id="btnPos" class="btn small">Pos (+)</button>
<button id="btnNeg" class="btn small">Neg (-)</button>
<button id="btnRemove" class="btn small">Remove</button>
<button id="btnConfirm" class="btn small">Confirm</button>
</div>
<label class="checkbox-label" style="margin-left: 10px; display: inline-flex; align-items: center;">
<input type="checkbox" id="chkUseNormal">
<span style="margin-left: 4px;">Use Normal</span>
</label>
<div>
<pre id="coordinatesDisplay">Click: </pre>
</div>
</div>
</div>
<script type="module">
import { initializePopup } from './popup.js'; // Import the popup module
const BACKEND = "http://127.0.0.1:8000"; // Example backend URL
// Initialize the popup functionality
const { showPopup } = initializePopup({
BACKEND,
canvasId: "segCanvas",
popupId: "popup",
btnPosId: "btnPos",
btnNegId: "btnNeg",
btnRemoveId: "btnRemove",
btnConfirmId: "btnConfirm",
coordinatesDisplayId: "coordinatesDisplay"
});
// Button for triggering the segmentation using the current viewpoint
const btnUseViewpoint = document.getElementById("btnUseViewpoint");
// Example of how you might trigger the popup when the user wants to use the viewpoint for segmentation
btnUseViewpoint.addEventListener("click", () => {
console.log('Use Viewpoint Button Clicked'); // Check if the event is triggered
// Assuming `selected_view` is the current camera view matrix or a similar object
const imageUrl = 'path-to-your-image.jpg'; // Replace with actual image URL
showPopup(imageUrl); // Display the popup with the image for segmentation
});
</script>
<script type="module" src="/main.js"></script>
</body>
</html>