question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

always getting "Malformed data passed to binarizer."

See original GitHub issue

Hi I am always getting the same malformed data error. Even when I simply create an Uint8Array filled with RGBA values I get the same error. like this: pixelBuffer = new Uint8Array(textureSize * textureSize * 4);

I have tried using Uint8ClampedArray with the same result. What am I doing wrong here?

I made a fiddle here with my project that throws the error. The error is thrown when you click on the screen.

To give you some background info on the fiddle, I am using the 3D graphics library Three.js to scan QR within the 3d environment (will be used for augmented reality). In the scene, the camera is being rendered out to a DataTexture like in this example. The idea is to use the Uint8Array texture data to give to jsQR.

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11

github_iconTop GitHub Comments

6reactions
vladikoffcommented, May 29, 2019

I had to change to the following new Uint8ClampedArray(png.toRGBA8(data)[0]) after decoding the png buffer, then it worked. Example:

    const data = png.decode(buffer);
    const out = {
      data: new Uint8ClampedArray(png.toRGBA8(data)[0]),
      height: data.height,
      width: data.width,
    };

    const code = jsQR(out.data, out.width, out.height);
6reactions
billykatzcommented, Dec 25, 2018

@erikparr, hey did you figure out what was wrong? Im getting a similar error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get a "Malformed data passed to binarizer" while ...
I found the error... I should use const code = jsQR(imageData, width, height);. instead of: const code = jsQR(imageData, blue.width, ...
Read more >
Add option to disable inverting (#78) - Codecell
throw new Error("Malformed data passed to binarizer."); } // Convert image to greyscale. blackPoints.set(hortizontalRegion, verticalRegion, average);.
Read more >
mtweb.cs.ucl.ac.uk/mus/lib/python2.7/scikit_learn-...
We get the default parameters from init and then # compare these against the actual values of the attributes. # this comes from...
Read more >
sklearn.preprocessing.Binarizer
Binarize data (set feature values to 0 or 1) according to a threshold. Values greater than the threshold map to 1, while values...
Read more >
Index (Spark 3.0.2 JavaDoc) - Apache Spark
Aborts this writing job because some data writers are failed and keep failing ... Get the attempt ID for this run, if the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found