Code Monkey home page Code Monkey logo

Comments (5)

ColonelParrot avatar ColonelParrot commented on July 17, 2024 1

Have you tried the example on the README? It's here

from jscanify.

adantart avatar adantart commented on July 17, 2024 1

Yes, sorry, I should have said it ... I tried it but it seems is broken since I see my webcam, and two divs (canvas and result) with just a zoomed in part of the camera (the top left part).
Sorry for the drawing, but something like this:
image

In mobile it's not working at all.
That's because I asked, maybe if you have a "whole" working HTML to check.

I have this:

<html>
<body>
<script src="src/opencv.js" async></script>
<script src="src/jscanify.js"></script>

<video id="video"></video>
<canvas id="canvas"></canvas>
<canvas id="result"></canvas>

<script>
const scanner = new jscanify();
const canvasCtx = canvas.getContext("2d");
const resultCtx = result.getContext("2d");
navigator.mediaDevices.getUserMedia({ video: true }).then((stream) => {
  video.srcObject = stream;
  video.onloadedmetadata = () => {
    video.play();

    setInterval(() => {
      canvasCtx.drawImage(video, 0, 0);
      const resultCanvas = scanner.highlightPaper(canvas);
      resultCtx.drawImage(resultCanvas, 0, 0);
    }, 10);
  };
});
</script>
</body>
</html>

from jscanify.

adantart avatar adantart commented on July 17, 2024 1

Yes, I did it that way forcing the width/height (setting them by javascript). No problem in that.
Thank you !

from jscanify.

adantart avatar adantart commented on July 17, 2024

It's because the canvas width and height. By default is always 300 x 150

from jscanify.

ColonelParrot avatar ColonelParrot commented on July 17, 2024

Interesting. I haven't taken a look at the specifics yet, but have you tried setting the dimensions of result to that of resultCanvas?

from jscanify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.