Issue 1:
System information (version)

OpenCV => 4.0.1 (WITH_HPX=ON)

Operating System / Platform => LUbuntu 16.04.6 x86_64

Compiler => CMake (uses c++)

HPX => 1.2.1

Detailed description

When reading from a VideoCapture(0) object the program crashes with an error:

terminate called after throwing an instance of 'hpx::exception_list'
what(): HPX(unknown_error)
[1] 7651 abort (core dumped) ./cpp_hpx_crash

Steps to reproduce

#include "opencv2/opencv.hpp"

int main()
{

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

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

return 0;
}

GDB Info

(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&, cv::ParallelLoopBody const&, 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&, cv::_OutputArray const&, int, bool, int, int) ()
from /usr/local/lib/libopencv_imgproc.so.4.0
#9 0x00007ffff1e0e5b5 in cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int) () from /usr/local/lib/libopencv_imgproc.so.4.0
#10 0x00007ffff7bbdfdc in cv::CvCaptureCAM_V4L::convertToRgb(cv::Buffer const&) ()
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&, int)
() from /usr/local/lib/libopencv_videoio.so.4.0
#13 0x00007ffff7ba6ffc in cv::VideoCapture::read(cv::_OutputArray const&) ()
from /usr/local/lib/libopencv_videoio.so.4.0
#14 0x0000000000406ca5 in main ()
at /home/REDACTED/cpp_hpx_crash.cpp:12

Issue 2:
System information (version)

OpenCV => 3.4.3

Operating System / Platform => Windows 7 64 Bit

Compiler => using this release : https://github.com/opencv/opencv/releases/download/3.4.3/opencv-3.4.3-vc14_vc15.exe with JDK 8

Detailed description

Hi ! I'm trying to translate this code sample https://github.com/opencv/opencv/blob/3.4/samples/dnn/text_detection.cpp to Java (whithout the video capture part).

I downloaded the model here : https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1.

I'm having this error :

Exception in thread "main" java.lang.Exception: unknown exception

at org.opencv.dnn.Net.forward_4(Native Method)

at org.opencv.dnn.Net.forward(Net.java:334)

at TextDetection.main(TextDetection.java:25)

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.

Steps to reproduce

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
//input model
Net net = Dnn.readNet("frozen_east_text_detection.pb");
// input image
Mat frame = Imgcodecs.imread("picture.jpg");
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<Mat> outs = new ArrayList<>(2);
List<String> outNames = Arrays.asList("feature_fusion/Conv_7/Sigmoid", "feature_fusion/concat_3");
net.forward(outs, outNames);

Is there anything I can do to bypass this error ?

Thanks,

Antoine