edi9999 / jsqrcode

[deprecated] Lazarsoft's jsqrcode as a node module, object oriented, and with tests
Apache License 2.0
278 stars 63 forks source link

Draw a Rectange around the Recognized Code... #51

Closed jogibear9988 closed 6 years ago

jogibear9988 commented 6 years ago

Is it possible to get the size, position and angle of the rect were the Barcode is found, to draw a rectangle around it (see here: https://serratus.github.io/quaggaJS/examples/live_w_locator.html)

edi9999 commented 6 years ago

Yes that is possible, the result of the qrcode processing returns x/y coordinates for each "module"

  "result": 'Test',
  "points": [
    {
      "count": 2,
      "estimatedModuleSize": 8,
      "x": 36,
      "y": 148,
    },
    {
      "count": 2,
      "estimatedModuleSize": 8,
      "x": 36,
      "y": 36,
    },
    {
      "count": 2,
      "estimatedModuleSize": 8,
      "x": 148,
      "y": 36,
    }
  ]
jogibear9988 commented 6 years ago

And the Angle? Or is it not possible to scan rotated?

edi9999 commented 6 years ago

It is possible to scan a rotated qrcode.

From the position of the three points, you should be able to draw a triangle and get the angle from that.