|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>realtime Depth Prediction using MiDas + TFLite</title> |
|
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script> |
|
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf-tflite.min.js"></script> |
|
<style> |
|
body { |
|
font-family: Arial, sans-serif; |
|
margin: 0; |
|
padding: 20px; |
|
background-color: #f0f0f0; |
|
} |
|
h1 { |
|
text-align: center; |
|
color: #333; |
|
} |
|
#container { |
|
display: flex; |
|
flex-direction: column; |
|
align-items: center; |
|
max-width: 800px; |
|
margin: 0 auto; |
|
background-color: white; |
|
border-radius: 10px; |
|
padding: 20px; |
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); |
|
} |
|
#video, #depthCanvas { |
|
width: 100%; |
|
max-width: 640px; |
|
height: auto; |
|
border-radius: 5px; |
|
margin-bottom: 20px; |
|
} |
|
#averageDepth { |
|
font-size: 1.2em; |
|
margin-bottom: 20px; |
|
padding: 10px; |
|
background-color: #e0e0e0; |
|
border-radius: 5px; |
|
} |
|
#swapButton { |
|
padding: 10px 20px; |
|
font-size: 1em; |
|
background-color: #4CAF50; |
|
color: white; |
|
border: none; |
|
border-radius: 5px; |
|
cursor: pointer; |
|
transition: background-color 0.3s; |
|
} |
|
#swapButton:hover { |
|
background-color: #45a049; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<h1> |
|
Live Depth Prediction using tfjs and <a href="https://arxiv.org/abs/1907.01341v3">MiDaS</a> |
|
</h1> |
|
<div id="container"> |
|
<video id="video" autoplay></video> |
|
<canvas id="depthCanvas"></canvas> |
|
<div id="averageDepth">Average Depth: N/A</div> |
|
<button id="swapButton">Swap Camera</button> |
|
</div> |
|
<script src="script.js"></script> |
|
</body> |
|
</html> |