New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataMatrix DMDetetor: traceGap() assertion may fail in noisy area #170
Comments
Could you provide a sample image that triggers this issue? |
I found one assertion failure in one image in my large dataset. However, I have modified the binarizer and use image pyramid. So the image may not trigger failure in the original code. I could provide the binarized BitMatrix image and the tracer state. |
I need something to reproduce the error on my machine. You should be able to dump your BitMatrix as a b/w image so that I can use that with the code as. Am I right to assume you are employing an image pyramid to improve the decoding of high resolution images? |
That's right, pyramid is to improve decoding of high-res image. I am trying to reproduce on your |
First set tryHarder = true in DMDetector.cpp Line 779, to enable multi-line scan to detect off-center symbols. Entry arguments: Line 340: in traceGaps() (lldb) p line (lldb) p *this (lldb) p gaps |
I can not reproduce the failed assertion with your sample image with current master (including the Your removal of the assertion will fix your immediate issue but the assertion is there to let me know if there still is a problem with endless loops in the code. I'd rather reproduce the problem first and maybe fix it at a more appropriate place. Thanks for the effort, though! |
Question: what compiler flags related to optimization/floating point math are you using? It could be that we get different results because you are using some relaxed floating point math, like |
No, I checked by default this flag if off. |
Have your tracer traced to p = (x = 273.5, y = 99.5)? |
The parameters are |
My trace passes through p = (x = 273.5, y = 99.5) as well but the contents of |
I use clang 11.0 [ 32%] Building CXX object core/CMakeFiles/ZXing.dir/src/datamatrix/DMDetector.cpp.o After make, run |
I noticed there is no |
That seemed like a very good guess, but it turns out, my linux clang-11 setup is not using that compiler flag either. I'm running out of ideas. It seems the only difference left is macOS + clang12 vs linux + clang11. My gut feeling says it is unlikely that this really is the root cause. Could you please double check that the input you are working with is exactly what you posted above? |
I checked the input is exactly what I posted above. Have you set |
Good question but, yes, I did. At this point I give up. I assume you don't mind if the assert stays (debug build only)? The release build will contain your fix. |
Thanks, I don't mind the asserts. Btw, there is also another assert in TraceStep(), which may fail in rare cases. I will keep filling more DataMatrix test cases and try to trigger it. I will notify you once I found another case. |
If the image is noisy after binarization,
traceGap()
assertion may fail on this line.https://github.com/nu-book/zxing-cpp/blob/b93fdeef39342a4af66c5c62a6b28d05379c9772/core/src/datamatrix/DMDetector.cpp#L554
Because there are actually two operations in the main while loop that moves EdgeTracer's current point
p
, and it may stay unmoved.Project back + centered()
andtraceStep()
happens to move the point in exactly the opposite direction. https://github.com/nu-book/zxing-cpp/blob/b93fdeef39342a4af66c5c62a6b28d05379c9772/core/src/datamatrix/DMDetector.cpp#L576 and https://github.com/nu-book/zxing-cpp/blob/b93fdeef39342a4af66c5c62a6b28d05379c9772/core/src/datamatrix/DMDetector.cpp#L607The text was updated successfully, but these errors were encountered: