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

Attempt to execute SCRIPT matchGMS as a function: #432

Closed krishnakumarrs closed 5 years ago

krishnakumarrs commented 5 years ago

I tried to execute gms_matcher file from samples but i am receiving this error message.

please help. thanks

amroamroamro commented 5 years ago

It probably means you haven't compiled the MEX-files?

Please follow the build instructions in the README file and wiki.

PS: The gms_matcher_*_demo.m sample uses cv.matchGMS from opencv_contrib modules, so you must build mexopencv against both opencv and opencv_contrib. (basically anything under the opencv_contrib/ directory requires the contributed modules)

krishnakumarrs commented 5 years ago

I have compiled the mexopencv from mexopencv_master folder. And also surf descriptor is working. but gms is not. I am using mac. please help.

amroamroamro commented 5 years ago

What opencv version did you build against? Are you using opencv_contrib? Also how did you build/install opencv?

Post the output of this:

>> cv.getBuildInformation()
krishnakumarrs commented 5 years ago

General configuration for OpenCV 3.4.3 ===================================== Version control: unknown

Extra modules: Location (extra): /Users///opencv_contrib-3.4.3/modules

amroamroamro commented 5 years ago

Can you show the full output? for starters I'm interested to see the list of modules built.

Normally for mexopencv functions, you would have a .m doc-file and a corresponding .maci64 mex-file. The error message "attempt to execute SCRIPT as a function" simply means the mex-file is missing and was not compiled.

So if you describe how you compiled opencv and mexopencv, I could help figure out the problem. You're not giving us much info here...

Please note that the current version of mexopencv targets opencv 3.4.1, your comment indicates you're using 3.4.3 instead. I suspect that may be the cause, you should use the supported version.

krishnakumarrs commented 5 years ago
General configuration for OpenCV 3.4.3 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            /Users/----/----/opencv_contrib-3.4.3/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2018-10-21T13:24:57Z
    Host:                        Darwin 17.5.0 x86_64
    CMake:                       3.12.0-rc3
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  (ver 9.1.0.9020039)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      
    Linker flags (Debug):        
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    js world
    Disabled by dependency:      -
    Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java matlab ovis sfm viz
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         YES

  GUI: 
    Cocoa:                       YES
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.11)
    JPEG:                        build-libjpeg-turbo (ver 1.5.3-62)
    WEBP:                        build (ver encoder: 0x020e)
    PNG:                         build (ver 1.6.34)
    TIFF:                        build (ver 42 - 4.0.9)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES

  Video I/O:
    DC1394:                      NO
    GStreamer:                   NO
    AVFoundation:                YES

  Parallel framework:            GCD

  Trace:                         YES (with Intel ITT)

  Python (for build):            /usr/bin/python2.7

  Java:                          
    ant:                         NO
    JNI:                         /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /usr/local
-----------------------------------------------------------------
krishnakumarrs commented 5 years ago

i have used homebrew to install opencv

amroamroamro commented 5 years ago

You didn't mention, but did you get any compile errors when building mexopencv?

Bottom line is you have to use the currently supported version of opencv 3.4.1 (I'm working on updating mexopencv to target opencv 3.4.2, 3.4.3, 3.4.4 soon)

I'm not a mac person, but I think you can do something like this to install a specific version of a homebrew formula:

$ brew install opencv@3.4.1
# with any other options like: --with-contrib

Otherwise you could also compile opencv/opencv_contrib from source yourself. See the wiki (instructions are for linux, but should be similar).

krishnakumarrs commented 5 years ago

I have compiled with opencv3.4.1 still i get the same error. please help.

amroamroamro commented 5 years ago

Please describe in detail the commands you use to build both opencv/opencv_contrib and mexopencv. I think you're missing something, but I can't help without you providing more info..

amroamroamro commented 5 years ago

Ok just to be sure, when you compile mexopencv, you are calling:

$ make all contrib

not just:

$ make

right?

krishnakumarrs commented 5 years ago

opencv 3.4.1 and opencv_contrib 3.4.1 --- make MATLABDIR=/Applications/MATLAB_R201a.app PKG_CONFIG_MATLAB=opencv3 LDFLAGS=-L/Users⁩/----/-------/⁨opencv-3.4.1⁩/⁨build⁩/lib -j2

amroamroamro commented 5 years ago

That explains it then, make alone doesn't compile opencv_contrib modules for mexopencv, you have to build both all and contrib targets.

So the call should be:

 $ make MATLABDIR=.. PKG_CONFIG_MATLAB=opencv3 -j2 all contrib

Since you already have compiled without contrib, you'll have to do make clean first to avoid linking errors regarding MxArray.

krishnakumarrs commented 5 years ago

Thanks it worked.