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

<ul dir="auto">
<li>OpenCV =&gt; 4.0.1 (WITH_HPX=ON)</li>
<li>Operating System / Platform =&gt; LUbuntu 16.04.6 x86_64</li>
<li>Compiler =&gt; CMake (uses c++)</li>
<li>HPX =&gt; 1.2.1</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">When reading from a VideoCapture(0) object the program crashes with an error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="terminate called after throwing an instance of 'hpx::exception_list'
  what():  HPX(unknown_error)
[1]    7651 abort (core dumped)  ./cpp_hpx_crash"><pre class="notranslate"><code class="notranslate">terminate called after throwing an instance of 'hpx::exception_list'
  what():  HPX(unknown_error)
[1]    7651 abort (core dumped)  ./cpp_hpx_crash
</code></pre></div>
<h5 dir="auto">Steps to reproduce</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#include &quot;opencv2/opencv.hpp&quot;

int main()
{

    cv::VideoCapture cap(0);
    cv::Mat frame;

    if(!cap.isOpened()) {
        exit(1);
    }   
    cap.read(frame);

    return 0;
}
"><pre class="notranslate"><code class="notranslate">#include "opencv2/opencv.hpp"

int main()
{

    cv::VideoCapture cap(0);
    cv::Mat frame;

    if(!cap.isOpened()) {
        exit(1);
    }   
    cap.read(frame);

    return 0;
}

</code></pre></div>
<h5 dir="auto">GDB Info</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(gdb) r
Starting program: /home/REDACTED/cpp_hpx_crash 
[Thread debugging using libthread_db enabled]
Using host libthread_db library &quot;/lib/x86_64-linux-gnu/libthread_db.so.1&quot;.
terminate called after throwing an instance of 'hpx::exception_list'
  what():  HPX(unknown_error)

Program received signal SIGABRT, Aborted.
0x00007ffff5f8a428 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0  0x00007ffff5f8a428 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff5f8c02a in __GI_abort () at abort.c:89
#2  0x00007ffff65c484d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff65c26b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff65c2701 in std::terminate() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff65c2969 in __cxa_rethrow ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff6bd9b7b in cv::parallel_for_(cv::Range const&amp;, cv::ParallelLoopBody const&amp;, double) () from /usr/local/lib/libopencv_core.so.4.0
#7  0x00007ffff1f4d355 in cv::hal::cvtOnePlaneYUVtoBGR(unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, int, bool, int, int) ()
   from /usr/local/lib/libopencv_imgproc.so.4.0
#8  0x00007ffff1f4f08d in cv::cvtColorOnePlaneYUV2BGR(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int, bool, int, int) ()
   from /usr/local/lib/libopencv_imgproc.so.4.0
#9  0x00007ffff1e0e5b5 in cv::cvtColor(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int, int) () from /usr/local/lib/libopencv_imgproc.so.4.0
#10 0x00007ffff7bbdfdc in cv::CvCaptureCAM_V4L::convertToRgb(cv::Buffer const&amp;) ()
   from /usr/local/lib/libopencv_videoio.so.4.0
#11 0x00007ffff7bbf0d3 in cv::CvCaptureCAM_V4L::retrieveFrame(int) ()
   from /usr/local/lib/libopencv_videoio.so.4.0
#12 0x00007ffff7ba762c in cv::VideoCapture::retrieve(cv::_OutputArray const&amp;, int)
    () from /usr/local/lib/libopencv_videoio.so.4.0
#13 0x00007ffff7ba6ffc in cv::VideoCapture::read(cv::_OutputArray const&amp;) ()
   from /usr/local/lib/libopencv_videoio.so.4.0
#14 0x0000000000406ca5 in main ()
    at /home/REDACTED/cpp_hpx_crash.cpp:12"><pre class="notranslate"><code class="notranslate">(gdb) r
Starting program: /home/REDACTED/cpp_hpx_crash 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
terminate called after throwing an instance of 'hpx::exception_list'
  what():  HPX(unknown_error)

Program received signal SIGABRT, Aborted.
0x00007ffff5f8a428 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0  0x00007ffff5f8a428 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff5f8c02a in __GI_abort () at abort.c:89
#2  0x00007ffff65c484d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff65c26b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff65c2701 in std::terminate() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff65c2969 in __cxa_rethrow ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff6bd9b7b in cv::parallel_for_(cv::Range const&amp;, cv::ParallelLoopBody const&amp;, double) () from /usr/local/lib/libopencv_core.so.4.0
#7  0x00007ffff1f4d355 in cv::hal::cvtOnePlaneYUVtoBGR(unsigned char const*, unsigned long, unsigned char*, unsigned long, int, int, int, bool, int, int) ()
   from /usr/local/lib/libopencv_imgproc.so.4.0
#8  0x00007ffff1f4f08d in cv::cvtColorOnePlaneYUV2BGR(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int, bool, int, int) ()
   from /usr/local/lib/libopencv_imgproc.so.4.0
#9  0x00007ffff1e0e5b5 in cv::cvtColor(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int, int) () from /usr/local/lib/libopencv_imgproc.so.4.0
#10 0x00007ffff7bbdfdc in cv::CvCaptureCAM_V4L::convertToRgb(cv::Buffer const&amp;) ()
   from /usr/local/lib/libopencv_videoio.so.4.0
#11 0x00007ffff7bbf0d3 in cv::CvCaptureCAM_V4L::retrieveFrame(int) ()
   from /usr/local/lib/libopencv_videoio.so.4.0
#12 0x00007ffff7ba762c in cv::VideoCapture::retrieve(cv::_OutputArray const&amp;, int)
    () from /usr/local/lib/libopencv_videoio.so.4.0
#13 0x00007ffff7ba6ffc in cv::VideoCapture::read(cv::_OutputArray const&amp;) ()
   from /usr/local/lib/libopencv_videoio.so.4.0
#14 0x0000000000406ca5 in main ()
    at /home/REDACTED/cpp_hpx_crash.cpp:12
</code></pre></div>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 3.4.3</li>
<li>Operating System / Platform =&gt; Windows 7 64 Bit</li>
<li>Compiler =&gt; using this release : <a href="https://github.com/opencv/opencv/releases/download/3.4.3/opencv-3.4.3-vc14_vc15.exe">https://github.com/opencv/opencv/releases/download/3.4.3/opencv-3.4.3-vc14_vc15.exe</a> with JDK 8</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">Hi ! I'm trying to translate this code sample <a href="https://github.com/opencv/opencv/blob/3.4/samples/dnn/text_detection.cpp">https://github.com/opencv/opencv/blob/3.4/samples/dnn/text_detection.cpp</a> to Java (whithout the video capture part).<br>
I downloaded the model here : <a href="https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1" rel="nofollow">https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1</a>.<br>
I'm having this error  :<br>
Exception in thread "main" java.lang.Exception: unknown exception<br>
at org.opencv.dnn.Net.forward_4(Native Method)<br>
at org.opencv.dnn.Net.forward(Net.java:334)<br>
at TextDetection.main(TextDetection.java:25)</p>
<p dir="auto">This error appears when I use the forward() method from the Net object. It seems to me, that when you use the forward method with two parameters (outs and outNames cf below), it won't work with more than one name. I try with only "feature_fusion/Conv_7/Sigmoid" or "feature_fusion/concat_3" and the method doesn't fail.</p>
<h5 dir="auto">Steps to reproduce</h5>

<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
//input model
Net net = Dnn.readNet(&quot;frozen_east_text_detection.pb&quot;);
// input image
Mat frame = Imgcodecs.imread(&quot;picture.jpg&quot;);
Mat blob = Dnn.blobFromImage(frame, 1.0, new Size(320,320), new Scalar(123.68, 116.78, 103.94), true, false);
net.setInput(blob);
List&lt;Mat&gt; outs = new ArrayList&lt;&gt;(2);
List&lt;String&gt; outNames = Arrays.asList(&quot;feature_fusion/Conv_7/Sigmoid&quot;, &quot;feature_fusion/concat_3&quot;);
net.forward(outs, outNames);"><pre class="notranslate"><span class="pl-smi">System</span>.<span class="pl-en">loadLibrary</span>(<span class="pl-smi">Core</span>.<span class="pl-c1">NATIVE_LIBRARY_NAME</span>);
<span class="pl-c">//input model</span>
<span class="pl-smi">Net</span> <span class="pl-s1">net</span> = <span class="pl-smi">Dnn</span>.<span class="pl-en">readNet</span>(<span class="pl-s">"frozen_east_text_detection.pb"</span>);
<span class="pl-c">// input image</span>
<span class="pl-smi">Mat</span> <span class="pl-s1">frame</span> = <span class="pl-smi">Imgcodecs</span>.<span class="pl-en">imread</span>(<span class="pl-s">"picture.jpg"</span>);
<span class="pl-smi">Mat</span> <span class="pl-s1">blob</span> = <span class="pl-smi">Dnn</span>.<span class="pl-en">blobFromImage</span>(<span class="pl-s1">frame</span>, <span class="pl-c1">1.0</span>, <span class="pl-k">new</span> <span class="pl-smi">Size</span>(<span class="pl-c1">320</span>,<span class="pl-c1">320</span>), <span class="pl-k">new</span> <span class="pl-smi">Scalar</span>(<span class="pl-c1">123.68</span>, <span class="pl-c1">116.78</span>, <span class="pl-c1">103.94</span>), <span class="pl-c1">true</span>, <span class="pl-c1">false</span>);
<span class="pl-s1">net</span>.<span class="pl-en">setInput</span>(<span class="pl-s1">blob</span>);
<span class="pl-smi">List</span>&lt;<span class="pl-smi">Mat</span>&gt; <span class="pl-s1">outs</span> = <span class="pl-k">new</span> <span class="pl-smi">ArrayList</span>&lt;&gt;(<span class="pl-c1">2</span>);
<span class="pl-smi">List</span>&lt;<span class="pl-smi">String</span>&gt; <span class="pl-s1">outNames</span> = <span class="pl-smi">Arrays</span>.<span class="pl-en">asList</span>(<span class="pl-s">"feature_fusion/Conv_7/Sigmoid"</span>, <span class="pl-s">"feature_fusion/concat_3"</span>);
<span class="pl-s1">net</span>.<span class="pl-en">forward</span>(<span class="pl-s1">outs</span>, <span class="pl-s1">outNames</span>);</pre></div>
<p dir="auto">Is there anything I can do to bypass this error ?</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Antoine</p>