Code Monkey home page Code Monkey logo

Comments (7)

ColonelParrot avatar ColonelParrot commented on July 17, 2024

Is this a software or hardware issue? Is the image coming from the camera blurry?

from jscanify.

justnixx avatar justnixx commented on July 17, 2024

from jscanify.

justnixx avatar justnixx commented on July 17, 2024

What I'm looking to achieve is:

  • a. The best possible image quality.
  • b. Dynamic width and height: I want the paper size to be determined by the image, rather than inputting dimensions manually, as not all documents are the same size.

Here's a demo link: https://jsscanner.netlify.app

from jscanify.

robinreckmann avatar robinreckmann commented on July 17, 2024

In the video constraints, did you try adding something like the following?

video: {
            width: { ideal: 99999 },
            height: { ideal: 99999 },
            facingMode: "environment"
        }

In the example you provided it looks like this:

navigator.mediaDevices.getUserMedia({
        video: { facingMode: 'environment' },
      });

from jscanify.

justnixx avatar justnixx commented on July 17, 2024

@robinreckmann Ah, no. Let me try that now.

from jscanify.

justnixx avatar justnixx commented on July 17, 2024

I've got it working to an extent, but there are some minor issues that I will try to fix later. Setting the initial width and height as follows:

    const constraints = {
      facingMode: 'environment',
      width: { ideal: 99999 },
      height: { ideal: 99999 },
    }
    const video = { audio: false, video: constraints };

was causing lagging on mobile, so I had to use advanced property instead.

const constraints = {
     facingMode: 'environment',
     advanced: [
       { width: { exact: 2560 } },
       { width: { exact: 1920 } },
       { width: { exact: 1280 } },
       { width: { exact: 1024 } },
       { width: { exact: 900 } },
       { width: { exact: 800 } },
       { width: { exact: 640 } },
       { width: { exact: 320 } },
     ],
   };

from jscanify.

ColonelParrot avatar ColonelParrot commented on July 17, 2024

Glad you could figure it out! If you come across any other issues, do let me know 👍

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.