chgatla-microsoft / QRTracking

MRTK sample app for QRtracking
MIT License
74 stars 69 forks source link

Very difficult to track QR #19

Open tmhab opened 3 years ago

tmhab commented 3 years ago

I have a hard time getting the deployed app to track when building from Unity 2019.4.10. Rarely, I can detect a QR code on a piece of paper, and then the GameObject never moves with the QR code after appearing.

andreasanta commented 3 years ago

Same issue with Unity 2019.4.8f1. The app with no modifications compiles, runs but does not detect QR codes. Sometimes a QR panel appears far away from the camera but it does not track anything and it links to "bing.com" only...

chgatla-microsoft commented 3 years ago

Do you have same issue when using the app https://github.com/chgatla-microsoft/QRTracking/releases/tag/SampleQRCodes_1.0.98.0_Master_Test? What is the version of OS you have and what device are you using?

andreasanta commented 3 years ago

I'm using the following:

Hololens 2 Windows version | 19041.1117.arm64fre.vb_release_svc_sydney_rel_prod.200903-1632 Unity 2019.4.8f1

Installed the sample app you linked, and this is the result:

https://www.youtube.com/watch?v=rzLX0R3XdvI (apologies for the bad quality of the video)

Thanks!

chgatla-microsoft commented 3 years ago

@andreasanta thanks for the info. Detecting QR codes from monitor might have issues due to image exposure. And the one you have on the wall might be small so you might have to go closer. The Hololens2 cameras are 640x480 limited resolution so small QR codes are little hard to see from far. That said do you have similar problems with QR code printed on to a paper?

andreasanta commented 3 years ago

@chgatla-microsoft Thanks for your quick reply. I will try on paper, but the qr code that appears on the wall is always there despite there is no QR code there at all. The app detects some sort of false positive that pops up in different locations all the time. I suspect the QR code on the screen is detected, but its coordinates/transform never updated. What can I do to help track the issue?

chgatla-microsoft commented 3 years ago

@andreasanta what you are seeing on the wall is a detected QR code before ( Did you have a qrcode there before? if not I would be surprised). you can see its timestamp. The QR tracking API gives you all the QR codes the system has detected ( and you might have removed those now or they might have been occuluded or they might be present now) the way to tell the difference is to look at the timestamp and the updated event to tell if it is currently in view or not. https://docs.microsoft.com/en-us/windows/mixed-reality/develop/platform-capabilities-and-apis/qr-code-tracking#managing-qr-code-data

andreasanta commented 3 years ago

@chgatla-microsoft Thanks, I will investigate the APIs. I did reboot the device and the phantom QR was gone. But I never had a QR code placed there. Maybe some false positive picked up in the past?

Also, I've tried some more experiments on paper, and you really need to be close, like very close to the QR for it to be detected. Also, I noticed the same QR with the same ID/Data is displayed different locations at the same time on screen. Please see this picture:

20200923_011708_HoloLens

You can see the QR code close to the actual location, and the same QR code (previously detected twice in other rooms), being displayed non occluded on screen "through the wall".

Is there a way to increase the chance of detection and to avoid duplication (or at least force occlusion so they don't show up several times at previous locations)?

Xan2063 commented 3 years ago

This issue https://github.com/chgatla-microsoft/QRTracking/issues/2 mentions, that the enumeration completed event is fired, when all the previously detected qr-codes have been replayed, so you could either drop all qr codes before that event or postpone the event subscription to added/updated/removed until that event is fired. Just be sure to subscribe it before you start else you might miss it. On our systems most QR-Codes are found by the update event without a previous add event, so be sure to handle this correctly.

I think because of the limited camera resolution less complex qr codes are detected much better and from a larger distance than complex qr codes. We first started with some json data, but had to get really close to the qr codes (like 15 cm). Then we changed to an id only and the distance changed to something about 50-70 cms.

Hope that helps.

tmhab commented 3 years ago

I have major improvements to QR detection by making my QR code REALLY big in the field of view. 30x30 cm at least and standing very close to them 20cm distance.

Following these: https://docs.microsoft.com/en-us/windows/mixed-reality/develop/platform-capabilities-and-apis/qr-code-tracking#best-practices-for-qr-code-detection

Note: Also I am using the #18 fix (now merged with this repo).

I'm considering closing this issue, @andreasanta will you create a new issue for the duplication problem if I close this one?

andreasanta commented 3 years ago

@tmhab Of course please go ahead and close.

@Xan2063 What you see in the picture all happened in the same session, no app restart. So the enumeration complete should not re-enumerate codes detected during the same session in different rooms, right? Thanks for the suggestions for the distance and density. Did you manage to trigger the scan from meters away? I really need 5-10 meters.

Xan2063 commented 3 years ago

@andreasanta I think reenumeration is triggered, whenever you restart the tracker. We have never seen that the qrCode removed event was triggered, so unless you remove the qrCodes yourself (by timestamp or whatever) they never disappear. If you track the same qr code again somewhere else, the old one is removed in the update but that's the only way they vanish. If you change room and hololens loses its tracking, you could see the qr codes of the other room at a new location depending on how the hololens matches the old room with the new one. At least that happens with our application when we change room. You might get around this with World anchors but we never tried ( no use case for us).

We never succeded in tracking several meters. I think this explains why https://docs.microsoft.com/en-us/windows/mixed-reality/develop/platform-capabilities-and-apis/qr-code-tracking#distance-and-angular-position-from-the-qr-code

Maybe it would work if you use the main camera for tracking as this one has a better resolution.

hummlj commented 3 years ago

Hi, I was using the QR tracker on HoloLens2 with MRTK2.3 and Unity 2019.3 and had no major issues. After upgrading to MRTK2.5 and Unity 2020.1 it became unusable. No changes in my project whatsoever and same QR targets.

NoTuxNoBux commented 2 years ago

The library also has QR versions from QR1 to QR40, but I've not been able to get QR codes above around QR15 to scan. I tested a QR code with a JSON string from around 400 to 950 characters (yes, it's a lot), but couldn't get any of these to scan, no matter the lighting or distance to it. I'm guessing the camera or trackers have trouble spotting these correctly.

Small to medium QR codes under 300 characters work reasonably well usually.