Redth / ZXing.Net.Mobile

Barcode Scanner for Xamarin.iOS, Xamarin.Android, UWP and Tizen
MIT License
1.07k stars 703 forks source link

Android: Android sample app doesn't ignore shaded areas in the overlay when scanning for QR/Bar code #87

Closed asednev closed 4 years ago

asednev commented 10 years ago

Original Barcode Scanner app based on ZXing java library does an outstanding job ignoring any possible QR codes in the shaded areas in overlay. ZXing.Net.Mobile implementation, however, disregards what's shaded in overlay and still looks for QR codes in the full frame.

Please see the screenshot below, I expect "A2 PART" being scanned nonetheless "TEST" gets scanned every single time when I point a camera the way it's on the screenshot.

Is this by design? Is there a way to achieve the behavior I expect?

Thanks

screenshot_2014-01-23-07-23-51

Redth commented 10 years ago

You're right, it does not exclude the grey areas (they are really just for show).

Currently there's no way to ignore certain regions of the preview from being checked... I suspect there is a possibility that multiple barcodes could be detected, but right now there's no way to request that to be checked, so it probably just returns the first one it sees...

Unfortunately there's not a great short fix that I can think of for this scenario. Yes I could only check a certain region, but what would the region be set to? It makes sense to use the non-gray areas if you're using the default overlay, but if you use a custom overlay, you might not want the same region checked. On Android there's so many different possible screen sizes, and even possible preview resolutions that it's not really as simple as specifying a region to crop. The only eventual possibility I think that might make sense is to be able to specify some sort of included region based on a % of the screen dimensions (eg: SetPreviewRegion(leftPaddingPercent, rightPaddingPercent, topPaddingPercent, bottomPaddingPercent); )... I'll mull that idea over...

For now, you'll just have to be careful in how you show the scanner a barcode... Sorry :(

gerryhigh commented 10 years ago

I would definitely like something like this. When I'm scanning 1D barcodes I'd ideally like to restrict it to scan a rectangular (landscape view); whereas when scanning 2D I'd like to restrict it to a square.

ljj901224 commented 9 years ago

has this problem been solved,I encounted the same scene.

bmacadam commented 8 years ago

I also think this would be a useful feature. In my case there are two barcodes in close proximity on a sticker and sometimes users think that the scanner is not working properly when in fact the issue is that the scanner is picking up the wrong barcode and it doesn't pass the validation test. I would expect that it might also improve performance if you are only checking 50% of the original preview image.

I also have to scan data matrix barcodes and it would be great if I could have a small square view finder.

Redth commented 8 years ago

I don't disagree that it would be a useful feature :) Just need some time to implement it (on ALL platforms - which is what takes so much effort).

Tebra commented 6 years ago

Any new information regarding this feature?

We are facing a problem which this feautre would solve immediately.

christophedemey commented 5 years ago

Hi, any news on how to not have this behaviour ? Is there any workaround ?

Thanks.

aashish181188 commented 5 years ago

@Redth , Is this issue fixed. Currently we are implementing barcode scan using ZXing in our Xamarin Forms project and we are facing issue with scanner. The scanner scans the barcode which not even in focus i.e. red line. It is a blocker for us, Kindly assist on this.

Any hint/tips appreciated.

package - https://www.nuget.org/packages/ZXing.Net.Mobile.Forms/ Technology - Xamarin Forms platform - iOS

If you need any other information , please let me know.

Thanks, Aashish

Redth commented 4 years ago

Track this in #791