Giter VIP home page Giter VIP logo

Comments (26)

serratus avatar serratus commented on September 28, 2024

That's odd. Currently I don't have access to a Moto X, but I just tried it on my LG G3 and it works just fine in Chrome Beta (42.0.2311.107). Which version of Chrome do you have?

screenshot_2015-04-16-23-18-08

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Problem exists in both 41.0.2272.96 and 42.0.2311.107

Some totally off the wall guesses: is that there is some kind of mis-match between the resolution of the returned data versus the reported camera resolution? Maybe some kind of re-sampling going on? Or maybe the pixel data isn't being returned in RGB? Perhaps an endianness issue?

I have the 2nd gen Moto X, but my wife has the 1st gen. I'll try it out on her phone as well to see if it's there.

from quaggajs.

serratus avatar serratus commented on September 28, 2024

I was able to reproduce this phenomenon on my friends Moto X as well. That's really odd, since both phones (LG G3 and Moto X) have the same architecture, CPU and OS. I'll try to come up with a basic camera test demo in order to get to the root of this issue.

Right now, I have no idea why it happens. Have you tried to run it in Firefox for Android?

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

I did try Firefox (said so in my first post) and it worked fine.

Nexus 4 works. First gen Moto X (the smaller one) works too.

I thought maybe it could be some customization that Motorola did on Android, but that seems unlikely.

My best guess is it's something specific to the second gen Moto X's camera.

If I get some time, I might look into it. Any guesses as to where I should start?

from quaggajs.

serratus avatar serratus commented on September 28, 2024

Alright, so this seems to be a device specific problem. I would say we start by creating a simple getUserMedia example which reads, manipulates and then displays the video again. I already have some code snippets that could help. But I can't address this issue before tomorrow. I'll let you know when I start working on it.

from quaggajs.

serratus avatar serratus commented on September 28, 2024

Let's give this gist a try. It is supposed to show a <video> above a <canvas> element of which both should show the current camera stream.

For now, this only works on Chrome, because of the constraints I've used (1280 x 720 px). You can also lower the resolution if you run into troubles. Due to security constraints, you have to serve the page from a web-server, and cannot run it directly from the filesystem.

from quaggajs.

qgxspace avatar qgxspace commented on September 28, 2024

ios system can support?

from quaggajs.

serratus avatar serratus commented on September 28, 2024

@qgxspace No, iOS is not supported because it lacks the getUserMedia API.

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

This works pretty much exactly how you would expect. Doesn't have the "corruption"

In your gist, you copy the data directly to the canvas, but Quagga copies the image to an intermediate array (Uint8Array ?) so that it can be manipulated. ImageWrapper is used for this purpose, right?

Can we just test out ImageWrapper by itself?

Kind of a long shot, but maybe it has something to do with aspect ratios? http://stackoverflow.com/questions/26415778/getusermedia-video-size-in-firefox-chrome-differs

from quaggajs.

serratus avatar serratus commented on September 28, 2024

Thanks for testing it on your Moto X. That's right, QuaggaJS converts the canvas-input to grayscale and then stores it in an Uint8Array. There is a way to use the ImageWrapper but only in conjunction with the FrameGrabber which actually takes care of copying the data.

Right, the aspect ratio differences between the browsers. But this should not be an issue, because I'm initializing the buffers after the video is loaded reading the dimensions directly from the stream.

I'll try to come up with a simple demo which only uses the minimal count of components to actually make it representable. Stay tuned!

from quaggajs.

stanver avatar stanver commented on September 28, 2024

@serratus hello if I use codova to get barcode in ios,can i use quaggaJS?

from quaggajs.

serratus avatar serratus commented on September 28, 2024

@stanver As far as I know, that's currently not possible. There are no useful plugins available which make the camera stream available in the HTML context (no getUserMedia). Maybe in the future. For now, the only way to go is by using the file-api for static images.

from quaggajs.

4thana avatar 4thana commented on September 28, 2024

the media capture plugin for cordova works also on iOS:
https://github.com/apache/cordova-plugin-media-capture

but of course it uses its own API instead of getUserMedia.

from quaggajs.

serratus avatar serratus commented on September 28, 2024

@4thana media-capture is a totally different story, since it does not allow to get access to the current stream that is being recorded. Only after the capturing is finished, the video/image can be used for further processing. That's the huge advantage of using getUserMedia. Some people are experimenting with exposing the camera-stream to a canvas with cordova plugins (e.g.: CanvasCamera)

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Maybe iOS support can be a separate issue instead of continuing to comment on this Moto X specific issue?

from quaggajs.

serratus avatar serratus commented on September 28, 2024

Sorry for the long absence, but I finally came up with a new demo for your problem. Can you give this a try and tell me if both, the <video> and <canvas> tag show the same image? What still puzzles me is the fact that the preview in the examples is a <video> element with the camera-stream attached. Nothing fancy, and no image processing whatsoever.

The link above simply demonstrates the first step of the quaggaJS pipeline, attaching the user's camera to the <video> element and copying that data to the <canvas>. Have you tried to set numOfWorkers to 0 in the examples just to make sure that the workers don't interfere with the system?

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Both the canvas and video show the same corrupted image.

Maybe it's a bug with Chrome + Camera firmware?

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Haven't tried adjusting workers.

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Works perfectly in Firefox

from quaggajs.

serratus avatar serratus commented on September 28, 2024

I've just created a more simplified version which just uses the CameraAccess part and displays the current video-stream. Can you give this a try?

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Still doesn't work.

screenshot_2015-05-31-22-31-23

from quaggajs.

luveti avatar luveti commented on September 28, 2024

I'm having this same issue on my Moto X

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Just double checked the example you posted at #27 (comment)

Still fails on Android version 5.1 and Chrome 43.0.2357.93

from quaggajs.

luveti avatar luveti commented on September 28, 2024

I'm still getting the same issue. I'm also testing on Android 5.1 with Chrome 43.0.2357.93. I've actually decided to just write my application natively due to this! As this may be an issue on more than just the Moto X.

screenshot_2015-07-28-10-18-00

from quaggajs.

serratus avatar serratus commented on September 28, 2024

Unfortunately I don't have any idea what's going on here. I guess the only way to find out is to report a bug directly at the Chromium team, since it seems to work on Firefox. I'll try to get my hands on a Moto X and create a minimal example producing this issue. Stay tuned!

@xDarkShadowKnightx Are you going to use zxing for your application? Using phonegap, or completely switching to native Android?

from quaggajs.

john-parton avatar john-parton commented on September 28, 2024

Verified fixed on my device. Good work! 👍

from quaggajs.

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.