-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscript.js
More file actions
196 lines (164 loc) · 7.62 KB
/
script.js
File metadata and controls
196 lines (164 loc) · 7.62 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
window.addEventListener('DOMContentLoaded', (event) => {
openNav();
});
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft= "0";
}
function showHome() {
document.getElementById('main').innerHTML = `
<img src="./assets/cctv.png" alt="CCTV" class="center-image"> <!-- CCTV 이미지 추가 -->
<div class="white-box">
<img src="./assets/box.png" alt="white-box" class="center-image">
<button onclick="showVideo1()" class="start-button">Start</button>
</div>
`;
}
function showVideo1() {
document.getElementById('main').innerHTML = `
<input type="file" id="videoUpload" accept="video/*" class="upload-button">
<div class="video-and-frames-container">
<div class="video-container">
<div class="video-section">
<p>Original Video</p>
<video id="uploadedVideo" controls style="display: none; width: 100%; max-width: 300px; margin-top: 10px;">
Your browser does not support the video tag.
</video>
</div>
<div class="video-section">
<p>Result Video</p>
<video id="resultVideo" controls style="display: none; width: 100%; max-width: 300px; margin-top: 10px;">
Your browser does not support the video tag.
</video>
</div>
</div>
<div id="garbageFramesContainer" class="frames-container"></div>
</div>
`;
document.getElementById('videoUpload').addEventListener('change', function(event) {
const file = event.target.files[0];
if (file) {
const videoElement = document.getElementById('uploadedVideo');
const videoURL = URL.createObjectURL(file);
videoElement.src = videoURL;
videoElement.style.display = 'block';
videoElement.load();
setTimeout(() => {
const resultVideoElement = document.getElementById('resultVideo');
const resultVideoURL = 'cctv_video/result/garbagedump_result.mp4';
resultVideoElement.src = resultVideoURL;
resultVideoElement.style.display = 'block';
resultVideoElement.load();
displayGarbageFrames([45, 139, 225]);
}, 10000);
}
});
}
function displayGarbageFrames(frames) {
const container = document.getElementById('garbageFramesContainer');
frames.forEach(frameNum => {
const frameBox = document.createElement('div');
frameBox.classList.add('frame-box');
const img = document.createElement('img');
img.src = `frame/detected_frames/frame_${frameNum}.jpg`;
img.alt = `Frame ${frameNum}`;
const frameInfo = document.createElement('div');
const frameNumText = document.createElement('p');
frameNumText.classList.add('frame-num');
frameNumText.textContent = `${frameNum} frame`;
const garbageText = document.createElement('p');
garbageText.textContent = 'Garbage Detected!!';
frameInfo.appendChild(frameNumText);
frameInfo.appendChild(garbageText);
frameBox.appendChild(img);
frameBox.appendChild(frameInfo);
container.appendChild(frameBox);
});
}
function showVideo2() {
document.getElementById('main').innerHTML = `
<div class="video-and-frames-container">
<div class="video-container">
<div class="video-section">
<div style="display: flex; align-items: center;">
<p style="margin-right: 10px;">Original Video</p>
<button id="detectButton" class="detect-button" style="background-color: #32CD32; color: white; border: none; padding: 5px 10px; cursor: pointer; font-size: 14px;">
Detect
</button>
</div>
<video id="uploadedVideo" controls style="width: 100%; max-width: 300px; margin-top: 10px;">
<source src="cctv_video/video2.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
<div class="video-section">
<p>Result Video</p>
<video id="resultVideo" controls style="display: none; width: 100%; max-width: 300px; margin-top: 10px;">
Your browser does not support the video tag.
</video>
</div>
</div>
<div id="garbageFramesContainer" class="frames-container"></div>
</div>
`;
document.getElementById('detectButton').addEventListener('click', function() {
const resultVideoElement = document.getElementById('resultVideo');
const resultVideoURL = 'cctv_video/result/garbagedump_result2.mp4'; // 결과 비디오 경로
resultVideoElement.src = resultVideoURL;
resultVideoElement.style.display = 'block';
resultVideoElement.load();
displayGarbageFrames2([38, 106, 181, 240, 301]);
});
}
function displayGarbageFrames2(frames) {
const container = document.getElementById('garbageFramesContainer');
frames.forEach(frameNum => {
const frameBox = document.createElement('div');
frameBox.classList.add('frame-box');
const img = document.createElement('img');
img.src = `frame/detected_frames2/frame_${frameNum}.png`;
img.alt = `Frame ${frameNum}`;
const frameInfo = document.createElement('div');
const frameNumText = document.createElement('p');
frameNumText.classList.add('frame-num');
frameNumText.textContent = `${frameNum} frame`;
const garbageText = document.createElement('p');
garbageText.textContent = 'Garbage Detected!!';
frameInfo.appendChild(frameNumText);
frameInfo.appendChild(garbageText);
frameBox.appendChild(img);
frameBox.appendChild(frameInfo);
container.appendChild(frameBox);
});
}
function showMembers() {
document.getElementById('main').innerHTML = `
<h1>Our Team</h1>
<div class="members-grid">
<div class="member-card" style="background-color: #EBE9FB;">
<img src="./assets/yaeji.png" alt="Yaeji Kim" class="member-photo">
<h3>Yaeji Kim</h3>
<a href="https://github.com/jyhannakim" target="_blank">Github_jyhannakim</a>
</div>
<div class="member-card" style="background-color: #facfd6;">
<img src="./assets/jaeyoung.png" alt="Jaeyoung Kim" class="member-photo">
<h3>Jaeyoung Kim</h3>
<a href="https://github.com/sevenrich03" target="_blank">Github_sevenrich03</a>
</div>
<div class="member-card" style="background-color: #DFF7FF;">
<img src="./assets/narae.png" alt="Narae Jang" class="member-photo">
<h3>Narae Jang</h3>
<a href="https://github.com/brandnewwwwnarae" target="_blank">Github_brandnewwwwnarae</a>
</div>
<div class="member-card" style="background-color: #EEFFD3;">
<img src="./assets/minju.png" alt="Minju Jang" class="member-photo">
<h3>Minju Jang</h3>
<a href="https://github.com/alswn-03" target="_blank">Github_alswn-03</a>
</div>
</div>
`;
}