ericblade / quagga2

An advanced barcode-scanner written in Javascript and TypeScript - Continuation from https://github.com/serratus/quaggajs
MIT License
758 stars 85 forks source link

result.box(es) position shifts when code detected and area defined #120

Open WardLootens opened 4 years ago

WardLootens commented 4 years ago

I noticed that the semantics of the result boxes seems to change as soon as a code is detected. This becomes visible when a non default inputstream.area is configured.

It seems that the boxes are moved when a barcode has been decoded.

Below some screenshots to clarify what I mean.

During decoding of images The green box marks the area (locate: false) quagga-boxes-processing

When code has been detected The blue box is supposed to mark the box that was used for decoding, but it is shifted to lower right, with (as far as I can tell) an offset similar to the position of the top left corner of the area. quagga-boxes-decoded

Relevant parts of config

inputStream: {
    type : "LiveStream",
    area: {
        top: '40%',
        right: '10%',
        bottom: '40%',
        left: '10%'
    },
},
locate: false,
ericblade commented 4 years ago

Would it be also possible to add anything relevant to the canvas, such as css that would affect the drawing area, and the code you're using to draw the lines/boxes/etc ?

I have noticed some weirdness with the area displayed using the "stock" example code, but I always use locate on in my app... I haven't noticed anything quite that weird. and I've always just attributed it to the fact that Android camera in chrome does some really strange things compared to desktop.

WardLootens commented 4 years ago

I just reproduced it in the standard live_w_locator example.

See adapted code here: https://github.com/WardLootens/quagga2/blob/120-result-boxes-shift/example/live_w_locator.js

See running example here: https://whocarez.be/cyberlab/barcodes/quaggaJS/example/live_w_locator.html