Overlay: Reversecamera with guidelines

Post Reply
noobychris
Posts: 25
Joined: Fri Aug 15, 2025 5:06 pm
Location: Germany
Contact:

Overlay: Reversecamera with guidelines

Post by noobychris »

Another example,
this time the reversecamera with guidelines :-)
I've simply added a overlay with a transparent .png to the camera example from GitHub (https://github.com/wiboma/hudiy/blob/ma ... amera.html).

The image must be named "lines.png" or yo have to change the name in the html file/code.
And you have to put the image in the same folder as the html file.

Code: Select all

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <style>
    html, body {
      margin: 0;
      padding: 0;
      background: black;
      height: 100%;
      overflow: hidden;
    }

    video, img#overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      object-fit: cover;
    }

    /* Overlay does not intercept clicks into the stream */
    img#overlay {
      pointer-events: none;
    }
  </style>
</head>
<body>
  <video id="cam" autoplay playsinline></video>
  <!-- Your transparent PNG as overlay -->
  <img id="overlay" src="lines.png" alt="Overlay" />

  <script>
    navigator.mediaDevices.getUserMedia({ video: true })
      .then(stream => {
        document.getElementById('cam').srcObject = stream;
      })
      .catch(err => {
        console.error("Camera error:", err);
      });
  </script>
</body>
</html>
Attachments
lines.png
lines.png (17.39 KiB) Viewed 511 times
wkl3968
Posts: 53
Joined: Thu Aug 07, 2025 12:22 pm

Re: Overlay: Reversecamera with guidelines

Post by wkl3968 »

What is the best USB video capture card for reverse camera usage?
Post Reply