Wrong number of arguments when running cv.getBuildInformation()
rehammaburas opened this issue · 5 comments
Hi,
I installed OpenCV 3.4.1 on Windows 10.
I have Matlab R2018a and compiled using Microsoft Visual C++ 2017.
I am getting an error when I run cv.getBuildInformation() as "Error using getBuildInformation Wrong number of arguments ". I tried to rename the dll files for Opencv in 'Matlab/R2018a/bin' but none of this helped.
Could you advise me for this issue?
Thanks.
That's strange, as the error message indicates, it means you're calling the function with the wrong of number of arguments.
The function takes no input and returns zero or one output. Are you calling it correctly?
>> cv.getBuildInformation()
http://amroamroamro.github.io/mexopencv/matlab/cv.getBuildInformation.html
Try running another function and see if it works:
>> im = cv.blur(rand(300));
>> imshow(im)
If the problem persists, I would ask for a few more details to troubleshoot:
-
how was OpenCV built and installed (precompiled binaries or manually compiled from source)?
>> !tree /F "C:\path\to\opencv\build\x64"
-
how did you build mexopencv (the exact
mexopencv.make
call)?>> path
-
is OpenCV added to the system PATH environment variable:
>> !set >> regexp(getenv('PATH'), pathsep(), 'split')'
-
do you have the Computer Vision System Toolbox installed?
>> ver vision >> !dir "C:\Program Files\MATLAB\R2018a\bin\win64\opencv*.dll"
-
use Dependency Walker to check that the correct OpenCV DLLs are being loaded (see this):
>> !"C:\path\to\x64\depends.exe" C:\path\to\mexopencv\+cv\getBuildInformation_.mexw64
Thank you for your reply.
-
OpenCV was manually compiled.
-
Attaching the output of
!tree
-
The mex command is:
mex -O -R2017b [rest of mex flags, src, objs, dst]
-
The PATH environment variables has OpenCV/build included
-
I have Computer Vision toolbox, I tried to rename the dlls but this did not fix the problem. (This is the output before renaming)
>> ver vision
MATLAB Version: 9.4.0.813654 (R2018a)
MATLAB License Number:
Operating System: Microsoft Windows 10 Education Version 10.0 (Build 17713)
Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Computer Vision System Toolbox Version 8.1 (R2018a)
>> !dir "C:\Program Files\MATLAB\R2018a\bin\win64\opencv*.dll"
Volume in drive C is Windows
Volume Serial Number is 96FC-E9AA
Directory of C:\Program Files\MATLAB\R2018a\bin\win64
02/06/2018 01:10 AM 1,851,392 opencv_calib3d310.dll
02/06/2018 01:10 AM 11,945,472 opencv_core310.dll
02/06/2018 01:10 AM 27,565,056 opencv_cudaarithm310.dll
02/06/2018 01:10 AM 506,880 opencv_cudabgsegm310.dll
02/06/2018 01:10 AM 4,723,712 opencv_cudafeatures2d310.dll
02/06/2018 01:10 AM 42,165,760 opencv_cudafilters310.dll
02/06/2018 01:10 AM 6,469,120 opencv_cudaimgproc310.dll
02/06/2018 01:10 AM 2,489,856 opencv_cudalegacy310.dll
02/06/2018 01:10 AM 527,872 opencv_cudaobjdetect310.dll
02/06/2018 01:10 AM 905,216 opencv_cudaoptflow310.dll
02/06/2018 01:10 AM 2,501,632 opencv_cudastereo310.dll
02/06/2018 01:10 AM 7,963,136 opencv_cudawarping310.dll
02/06/2018 01:10 AM 10,752 opencv_cudev310.dll
02/06/2018 01:10 AM 688,640 opencv_features2d310.dll
02/06/2018 01:10 AM 466,944 opencv_flann310.dll
02/06/2018 01:10 AM 24,753,152 opencv_imgproc310.dll
02/06/2018 01:10 AM 671,744 opencv_ml310.dll
02/06/2018 01:10 AM 495,104 opencv_objdetect310.dll
02/06/2018 01:10 AM 1,251,840 opencv_photo310.dll
02/06/2018 01:10 AM 280,576 opencv_shape310.dll
02/06/2018 01:10 AM 965,120 opencv_stitching310.dll
02/06/2018 01:10 AM 382,976 opencv_superres310.dll
02/06/2018 01:10 AM 356,352 opencv_video310.dll
02/06/2018 01:10 AM 723,456 opencv_videostab310.dll
24 File(s) 140,661,760 bytes
0 Dir(s) 348,201,054,208 bytes free
- Part of the output of Dependency walker is shown in attached image
It gets the opencv dll from the correct directory, but then it shows a circular dependency between:
c:\program files\matlab\r2018a\bin\win64\API-MS-WIN-CORE-SYNCH-L1-2-0.DLL
c:\windows\system32\KERNEL32.DLL
OpenCV was manually compiled
I would still like to know about the build configuration (enabled opencv modules, external libraries, compiler flags, installation path, etc.). Normally you get a summary at the end of the CMake configuration step (basically the same output cv.getBuildInformation
would give).
Did you follow our installation guide in the wiki?
Attaching the output of tree
sorry I meant !tree /F "C:\dev\build\install\x64"
(the location containing the compiled binaries)
The mex command is ..
It would help to see the actual commands.
I'm wondering here, did you use mexopencv.make
or are you manually compiling them by calling mex
yourself?
Also asking if you've enabled opencv_contrib
?
The PATH environment variables has OpenCV/build included
Sorry to be nit-picky, but it would help to see the PATH contents (feel free to edit out anything private). In the past people had multiple installations of opencv with the wrong ordering which caused problems, so I'm just making sure here.
Also making sure you correctly added mexopencv to the matlab path (i.e addpath
).
>> which -all cv.getBuildInformation
Computer Vision toolbox
Right, so there should be no conflict with CVST dll's, and you dont need to rename them. They have different names (opencv_core310
vs opencv_core341
) so it's fine.
Dependency walker
It looks like the correct opencv DLLs are being loaded, as it should.
Just collapse the list and only look at the top level dependencies.
Don't worry about the circular dependencies (Windows loader handles that stuff), I'm only concerned with the opencv_*.dll
DLLs.
So far I can't tell what the problem is, so please review my points above again..
I would ask if you made any changes to the C++ source file getBuildInformation.cpp
?
Also did you try running another mexopencv function (say the cv.blur
example above)?
Are you getting the same error?
Thank you for your help.
I found that I was editing the mex flags in the make file to fix some compilation errors. I returned to the original make file and the problem is now solved.