/
index.html
125 lines (108 loc) 路 2.9 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>blur-background-ts</title>
<style>
@import url("https://fonts.googleapis.com/css2?family=Ubuntu+Mono&display=swap");
* {
font-family: "Ubuntu Mono", monospace;
box-sizing: border-box;
}
.container {
width: 50%;
margin: auto;
max-width: 700px;
min-width: 300px;
}
.relative {
position: relative;
}
.text-center {
text-align: center;
}
video {
width: 50%;
object-fit: contain;
flex-shrink: 0;
}
img {
width: 100%;
}
canvas {
border: 1px solid #ddd;
width: 100%;
margin: auto;
flex-shrink: 0;
}
#result {
display: flex;
flex-wrap: wrap;
}
#result > div {
width: 100%;
}
@media only screen and (min-width: 768px) {
#result > div {
width: 50%;
}
}
.item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="relative">
<h1 class="text-center">blur-background-ts</h1>
<img id="image" src="./imgs/IMG_0158 2 Large.jpeg" alt="" crossorigin="anonymous" />
<input accept="image/*" type="file" />
</div>
<div id="result">
<div class="item">
<h3 class="text-center">Blur background</h3>
<canvas id="canvas"></canvas>
</div>
<div class="item">
<h3 class="text-center">Change background to new color</h3>
<canvas id="canvas-bg-color"></canvas>
</div>
<div class="item">
<h3 class="text-center">Crop background image</h3>
<canvas id="canvas-crop"></canvas>
</div>
<div class="item">
<h3 class="text-center">Change background to image</h3>
<canvas id="canvas-img"></canvas>
<img
crossorigin="anonymous"
style="display: none"
id="bg-img"
src="./imgs/d80e3cbbd11095103a2eb8ae88eeb1bb.jpg"
alt=""
/>
</div>
</div>
<div class="item">
<h3 class="text-center">Blur webcam</h3>
<video
style="visibility: hidden; position: absolute"
autoplay
muted
playsinline
width="300"
height="150"
></video>
<canvas width="300" height="150" id="canvas-video"></canvas>
<div><button type="button" style="margin-top: 5px" id="enableWebcamButton">ENABLE SEGMENTATION</button></div>
</div>
</div>
<script src="./index.ts" type="module"></script>
</body>
</html>