<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 3.4 / master branch</li>
<li>Operating System / Platform =&gt; Jetson TX2 Aarch64 Ubuntu 16.04 64bit</li>
<li>Compiler =&gt; GCC 5.4.0</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I wrote PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="373065176" data-permission-text="Title is private" data-url="https://github.com/opencv/opencv/issues/12905" data-hovercard-type="pull_request" data-hovercard-url="/opencv/opencv/pull/12905/hovercard" href="https://github.com/opencv/opencv/pull/12905">#12905</a> , but even after mergin this PR, the test fails on Jetson TX2 (Aarch64)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ./bin/opencv_test_objdetect --gtest_filter=*QRC*/25
CTEST_FULL_OUTPUT
OpenCV version: 3.4.3-dev
OpenCV VCS version: 3.4.3-357-gd3f75df-dirty
Build type: Release
Compiler: /usr/bin/c++  (ver 5.4.0)
Parallel framework: pthreads
CPU features: NEON FP16
OpenCL is disabled
Note: Google Test filter = *QRC*/25
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Objdetect_QRCode
[ RUN      ] Objdetect_QRCode.regression/25, where GetParam() = &quot;russian.jpg&quot;
/home/nvidia/opencv-fork/modules/objdetect/test/test_qrcode.cpp:69: Failure
Value of: detectQRCode(src, corners)
  Actual: false
Expected: true
[  FAILED  ] Objdetect_QRCode.regression/25, where GetParam() = &quot;russian.jpg&quot; (120 ms)
[----------] 1 test from Objdetect_QRCode (120 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (120 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Objdetect_QRCode.regression/25, where GetParam() = &quot;russian.jpg&quot;

 1 FAILED TEST"><pre class="notranslate"><code class="notranslate">$ ./bin/opencv_test_objdetect --gtest_filter=*QRC*/25
CTEST_FULL_OUTPUT
OpenCV version: 3.4.3-dev
OpenCV VCS version: 3.4.3-357-gd3f75df-dirty
Build type: Release
Compiler: /usr/bin/c++  (ver 5.4.0)
Parallel framework: pthreads
CPU features: NEON FP16
OpenCL is disabled
Note: Google Test filter = *QRC*/25
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Objdetect_QRCode
[ RUN      ] Objdetect_QRCode.regression/25, where GetParam() = "russian.jpg"
/home/nvidia/opencv-fork/modules/objdetect/test/test_qrcode.cpp:69: Failure
Value of: detectQRCode(src, corners)
  Actual: false
Expected: true
[  FAILED  ] Objdetect_QRCode.regression/25, where GetParam() = "russian.jpg" (120 ms)
[----------] 1 test from Objdetect_QRCode (120 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (120 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Objdetect_QRCode.regression/25, where GetParam() = "russian.jpg"

 1 FAILED TEST
</code></pre></div>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="373065176" data-permission-text="Title is private" data-url="https://github.com/opencv/opencv/issues/12905" data-hovercard-type="pull_request" data-hovercard-url="/opencv/opencv/pull/12905/hovercard" href="https://github.com/opencv/opencv/pull/12905">#12905</a> was fixing the "decode" part, but this failure is on  "detect" part.<br>
Looking back , the detection was failed on <a href="https://github.com/opencv/opencv/blob/ab2c16b2e55acaf193815e43475eb11670c45d60/modules/objdetect/src/qrcode.cpp#L319">this</a> if section<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/opencv/opencv/blob/ab2c16b2e55acaf193815e43475eb11670c45d60/modules/objdetect/src/qrcode.cpp#L319">opencv/modules/objdetect/src/qrcode.cpp</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 319
      in
      <a data-pjax="true" class="commit-tease-sha" href="/opencv/opencv/commit/ab2c16b2e55acaf193815e43475eb11670c45d60">ab2c16b</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L319" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="319"></td>
          <td id="LC319" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span>( list_lines_y.<span class="pl-c1">size</span>() &lt; <span class="pl-c1">3</span> ) { <span class="pl-k">return</span> <span class="pl-c1">false</span>; } </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
Tracing back, the different behaviour comes from <a href="https://github.com/opencv/opencv/blob/ab2c16b2e55acaf193815e43475eb11670c45d60/modules/objdetect/src/qrcode.cpp#L202-L205">here</a><br>
<div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/opencv/opencv/blob/ab2c16b2e55acaf193815e43475eb11670c45d60/modules/objdetect/src/qrcode.cpp#L202-L205">opencv/modules/objdetect/src/qrcode.cpp</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 202 to 205
      in
      <a data-pjax="true" class="commit-tease-sha" href="/opencv/opencv/commit/ab2c16b2e55acaf193815e43475eb11670c45d60">ab2c16b</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L202" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="202"></td>
          <td id="LC202" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span>(weight &lt; eps_horizontal) </td>
        </tr>

        <tr class="border-0">
          <td id="L203" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="203"></td>
          <td id="LC203" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> { </td>
        </tr>

        <tr class="border-0">
          <td id="L204" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="204"></td>
          <td id="LC204" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     result.<span class="pl-c1">push_back</span>(list_lines[pnt]); </td>
        </tr>

        <tr class="border-0">
          <td id="L205" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="205"></td>
          <td id="LC205" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> } </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
This is computing the ratio of black and white, which should follow the QR code spec 1:1:3:1:1.<br>
Unfortunately, this test case No. 25 is quite diagonal, so the ratio error becomes bit large, large enough above eps.<p></p>
<p dir="auto">The difference of the binary image is very small.<br>
Probably this difference comes from <code class="notranslate">adaptiveThreshold</code><br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/opencv/opencv/blob/ab2c16b2e55acaf193815e43475eb11670c45d60/modules/objdetect/src/qrcode.cpp#L69">opencv/modules/objdetect/src/qrcode.cpp</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 69
      in
      <a data-pjax="true" class="commit-tease-sha" href="/opencv/opencv/commit/ab2c16b2e55acaf193815e43475eb11670c45d60">ab2c16b</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L69" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="69"></td>
          <td id="LC69" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c1">adaptiveThreshold</span>(barcode, bin_barcode, <span class="pl-c1">255</span>, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY, <span class="pl-c1">83</span>, <span class="pl-c1">2</span>); </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
It's using <code class="notranslate">ADAPTIVE_THRESH_GAUSSIAN_C</code>, so probably it has float rounding inside, and thus the binary image doesn't become "bit-exact"<p></p>
<p dir="auto">I also loosen the <code class="notranslate">eps_horizontal</code> default_value from 0.1 to 0.11 and 0.2 <a href="https://github.com/opencv/opencv/blob/ab2c16b2e55acaf193815e43475eb11670c45d60/modules/objdetect/src/qrcode.cpp#L28">here</a><br>
In either case, this test No. 25 passes, but that causes false positive on other test cases.</p>
<p dir="auto">So as a result of looking in this implementation, this test No.25 is on the edge of this algorithm, very edge so that even a rounding error could cause a different behavior<br>
Now, I'd like to discuss about how to work with this issue.</p>
<ol dir="auto">
<li>ignore and keep this test fail on Aarch64</li>
<li>disable/skip this test on platform other than x86 (or totally remove this test case)</li>
<li>fix it from the source (this at least includes the implementation of bit-exact <code class="notranslate">adaptiveThreshold</code>)</li>
</ol>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">Run <code class="notranslate">opencv_test_objdetect</code> on Jetson TX2 (probably on any Aarch64 platform)</p>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.0.0 --&gt; 4.1.0-pre</li>
<li>Operating System / Platform =&gt; Ubuntu 16.04</li>
<li>Compiler =&gt; gcc 6.4</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">When running the <a href="https://docs.opencv.org/trunk/d8/d19/tutorial_stitcher.html" rel="nofollow">detailed stitching example</a>, this error occurred:</p>
<blockquote>
<p dir="auto">/io/opencv/modules/core/src/ocl.cpp:4766: error: (-215:Assertion failed) u-&gt;refcount == 0 &amp;&amp; "UMat deallocation error: some derived Mat is still alive" in function 'deallocate'</p>
</blockquote>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">Running <code class="notranslate">stitching_detailed.cpp</code> or <code class="notranslate">stitching_detailed.py</code>.</p>