kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
661 stars 319 forks source link

problems testing mexopencv #436

Closed MOONBEAR0703 closed 5 years ago

MOONBEAR0703 commented 5 years ago

And after I make and make all contrib, I make test, and it shows:

addpath(pwd);cd test;try,UnitTest('ContribModules',);catch e,disp(e.getReport);end;exit;
                                                    |
Error: Parentheses or square brackets are asymmetrical or abnormal.
amroamroamro commented 5 years ago

Yes there was a bug in the makefile (previously reported in #375) which we fixed in the later 3.3.1 release.

Since you're using an older version, just manually call UnitTest in MATLAB instead of make test. (FYI the fix 0454964)

MOONBEAR0703 commented 5 years ago

After I call UnitTest it shows as below:

Totals:
  1112 Passed, 8 Failed, 21 Incomplete
  Elapsed time is 1114.437371 seconds.

Because I need to use cv.VideoCapture, I want to solve the error among the 29 errors:

===== Incomplete: TestVideoCapture.test_camera =====
wrongly using TestVideoCapture.test_camera (line 40)
todo
error UnitTest>testcase_run (line 456)
                   feval(t);
error UnitTest>testsuite_run (line 421)
               status = testcase_run(tests{i}, opts);
error UnitTest (line 79)
         [results, passed] = testsuite_run(tests, opts);
amroamroamro commented 5 years ago

"Incomplete" are not failures, they are simply skipped tests. You can safely ignore those.

You should mention the 8 failed ones though..

MOONBEAR0703 commented 5 years ago

Well, I copy one of the errors below. Could you help me?

===== Failure: TestCascadeClassifier.test_new_format =====
wrong using <a href="matlab:matlab.internal.language.introspective.errorDocCallback('urlreadwrite', '/usr/local/MATLAB/R2016b/toolbox/matlab/iofun/private/urlreadwrite.m', 98)" style="font-weight:bold">urlreadwrite</a> (<a href="matlab: opentoline('/usr/local/MATLAB/R2016b/toolbox/matlab/iofun/private/urlreadwrite.m',98,0)">line 98</a>)

error <a href="matlab:matlab.internal.language.introspective.errorDocCallback('urlwrite', '/usr/local/MATLAB/R2016b/toolbox/matlab/iofun/urlwrite.m', 38)" style="font-weight:bold">urlwrite</a> (<a href="matlab: opentoline('/usr/local/MATLAB/R2016b/toolbox/matlab/iofun/urlwrite.m',38,0)">line 38</a>)
[f,status] = urlreadwrite(mfilename,catchErrors,url,filename,varargin{:});

error <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('TestCascadeClassifier>download_classifier_xml', '/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/unit_tests/TestCascadeClassifier.m', 110)" style="font-weight:bold">TestCascadeClassifier>download_classifier_xml</a> (<a href="matlab: opentoline('/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/unit_tests/TestCascadeClassifier.m',110,0)">line 110</a>)
        urlwrite([url f ext], fname);

error <a href="matlab:matlab.internal.language.introspective.errorDocCallback('TestCascadeClassifier.test_new_format', '/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/unit_tests/TestCascadeClassifier.m', 23)" style="font-weight:bold">TestCascadeClassifier.test_new_format</a> (<a href="matlab: opentoline('/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/unit_tests/TestCascadeClassifier.m',23,0)">line 23</a>)
            download_classifier_xml(xmlfile);

error <a href="matlab:matlab.internal.language.introspective.errorDocCallback('UnitTest>testcase_run', '/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/UnitTest.m', 456)" style="font-weight:bold">UnitTest>testcase_run</a> (<a href="matlab: opentoline('/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/UnitTest.m',456,0)">line 456</a>)
                feval(t);

error <a href="matlab:matlab.internal.language.introspective.errorDocCallback('UnitTest>testsuite_run', '/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/UnitTest.m', 421)" style="font-weight:bold">UnitTest>testsuite_run</a> (<a href="matlab: opentoline('/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/UnitTest.m',421,0)">line 421</a>)
        status = testcase_run(tests{i}, opts);

error <a href="matlab:matlab.internal.language.introspective.errorDocCallback('UnitTest', '/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/UnitTest.m', 79)" style="font-weight:bold">UnitTest</a> (<a href="matlab: opentoline('/media/lab324/sdc1/xy/DeepCC/src/external/mexopencv-3.2.0/test/UnitTest.m',79,0)">line 79</a>)
    [results, passed] = testsuite_run(tests, opts);
amroamroamro commented 5 years ago

It sounds like a networking error. You see some tests need to download additional files, and this seems to fail in your case.

I don't know why, but you can try to manually download them yourself. For the failed test you've shown above TestCascadeClassifier.test_new_format, the file is:

https://cdn.rawgit.com/opencv/opencv/3.2.0/data/haarcascades/haarcascade_frontalface_default.xml

download it and put the file in ./mexopencv/test/ directory.

amroamroamro commented 5 years ago

One more thing, it seems that the RawGit service is shutting down, so these urls might start to fail in the future (they still work for now). I am changing those URLs back to directly using github and I will be pushing the fix soon (for the current version), i.e changing urls from:

https://cdn.rawgit.com/opencv/opencv/...

to

https://raw.github.com/opencv/opencv/...

The reason I used RawGit in the first place is because Github serves all files with the wrong "text/plain" MIME type.

MOONBEAR0703 commented 5 years ago

Well, yes, for some reasons, the urls are invalid. And if it doesn't matter to my using of mexopencv, I will let it go~~ Thanks, anyway!

amroamroamro commented 5 years ago

Yes in general the downloaded files in ./mexopencv/test/ are mostly used for tests and demos (stuff like test images, videos, or pretrained models). Technically you don't need them to use mexopencv. We choose to download them externally to keep the repo size small.

You can can always download these yourself. Depending on the files, some common locations where they are usually found:

If you search for urlwrite, you'll find which mexopencv tests and demos are downloading external files.