Giter Club home page Giter Club logo

mexopencv's Introduction

mexopencv

Travis AppVeyor License

Collection and development kit of MATLAB MEX functions for OpenCV library.

The package provides MATLAB MEX functions that interface with hundreds of OpenCV APIs. Also the package contains a C++ class that converts between MATLAB's native data type and OpenCV data types. The package is suitable for fast prototyping of OpenCV application in MATLAB, use of OpenCV as an external toolbox in MATLAB, and development of custom MEX functions.

The current version of mexopencv is compatible with OpenCV 3.4.1.

For previous OpenCV 3.x versions, checkout the corresponding tags:

For OpenCV 2.x, checkout these older branches:

Consult the wiki for help.

Table of Contents

Structure

The project tree is organized as follows:

+cv/             OpenCV or custom API directory
+mexopencv/      mexopencv utility API directory
doc/             directory for documentation
include/         header files
lib/             directory for compiled C++ library files
samples/         directory for sample application codes
src/             directory for C++ source files
src/+cv/         directory for MEX source files
src/+cv/private/ directory for private MEX source files
test/            directory for test scripts and resources
opencv_contrib/  directory for sources/samples/tests of additional modules
utils/           directory for utilities
Doxyfile         config file for doxygen
Makefile         make script
README.markdown  this file

Build

Prerequisite

Depending on your platform, you also need the required build tools:

  • Linux: g++, make, pkg-config
  • OS X: Xcode Command Line Tools, pkg-config
  • Windows: Visual Studio

Refer to the Makefile and make.m scripts for a complete list of options accepted for building mexopencv across supported platforms.

Refer to the wiki for detailed build instructions.

OpenCV

Currently, mexopencv targets the final 3.4.1 stable version of OpenCV. You must build it against this exact version, rather than using the bleeding-edge dev-version of opencv and opencv_contrib. UNIX users should consider using a package manager to install OpenCV if available.

DO NOT use the "master" branch of opencv and opencv_contrib! Only the 3.4.1 release is supported by mexopencv.

Linux

First make sure you have OpenCV 3.4.1 installed in the system:

  • if applicable, install OpenCV 3 package available in your package manager (e.g., libopencv-dev in Debian/Ubuntu, opencv-devel in Fedora). Note that these packages are not always up-to-date, so you might need to use older mexopencv versions to match their opencv package version.

  • otherwise, you can always build and install OpenCV from source:

      $ cd <opencv_build_dir>
      $ cmake <options> <opencv_src_dir>
      $ make
      $ sudo make install
    

At this point, you should make sure that the pkg-config command can identify and locate OpenCV libraries (if needed, set the PKG_CONFIG_PATH environment variable to help it find the opencv.pc file):

$ pkg-config --cflags --libs opencv

If you have all the prerequisites, go to the mexopencv directory and type:

$ make

This will build and place all MEX functions inside +cv/. Specify your MATLAB directory if you installed MATLAB to a non-default location:

$ make MATLABDIR=/opt/local/MATLAB/R2017a

You can also work with Octave instead of MATLAB by specifying:

$ make WITH_OCTAVE=true

To enable support for contributed modules, you must build OpenCV from both opencv and opencv_contrib sources. You can then compile mexopencv as:

$ make all contrib

Finally you can test mexopencv functionality:

$ make test

Developer documentation can be generated with Doxygen if installed:

$ make doc

This will create HTML files under doc/.

Refer to the wiki for detailed instructions on how to compile OpenCV for both MATLAB and Octave.

OS X

Currently, the recommended approach to install OpenCV in OS X is Homebrew. Install Homebrew first, and do the following to install OpenCV 3:

$ brew install pkg-config homebrew/science/opencv3
$ brew link opencv3

Otherwise, you can build OpenCV from source, similar to the Linux case.

If you have all the prerequisites, go to the mexopencv directory and run (modifying the options as needed):

$ make MATLABDIR=/Applications/MATLAB_R2016a.app PKG_CONFIG_MATLAB=opencv3 LDFLAGS=-L/usr/local/share/OpenCV/3rdparty/lib -j2

Replace the path to MATLAB with your version. This will build and place all MEX functions inside +cv/.

Windows

Refer to the wiki for detailed instructions on how to compile OpenCV on Windows, and build mexopencv against it.

In a nutshell, execute the following in MATLAB to compile mexopencv:

>> addpath('C:\path\to\mexopencv')
>> mexopencv.make('opencv_path','C:\OpenCV\build')

Replace the path above with the location where OpenCV binaries are installed (i.e location specified in CMAKE_INSTALL_PREFIX while building OpenCV).

Contrib modules are enabled as:

>> addpath('C:\path\to\mexopencv')
>> addpath('C:\path\to\mexopencv\opencv_contrib')
>> mexopencv.make('opencv_path','C:\OpenCV\build', 'opencv_contrib',true)

If you have previously compiled mexopencv with a different configuration, don't forget to clean old artifacts before building:

>> mexopencv.make('clean',true, 'opencv_contrib',true)

Usage

Once MEX functions are compiled, you can add path to the project directory and call MEX functions within MATLAB using package name cv.

addpath('/path/to/mexopencv');
addpath('/path/to/mexopencv/opencv_contrib');

% recommended
out = cv.filter2D(img, kern);  % with package name 'cv'

% not recommended
import cv.*;
out = filter2D(img, kern);     % no need to specify 'cv' after imported

Note that some functions such as cv.imread will overload MATLAB's built-in imread function when imported. Use the scoped name when you need to avoid name collision. It is also possible to import individual functions. Check help import in MATLAB.

Check a list of functions available by help command in MATLAB.

>> help cv;              % shows list of functions in package 'cv'

>> help cv.VideoCapture; % shows documentation of VideoCapture

Look at the samples/ directory for examples.

Documentation

mexopencv includes a simple documentation utility that generates HTML help files for MATLAB. The following command creates HTML user documentation under doc/matlab/ directory.

addpath('/path/to/mexopencv/utils');
MDoc;

On-line documentation is available.

Unit Testing

You can test the functionality of compiled files by UnitTest class located inside test directory.

addpath('/path/to/mexopencv/test');
UnitTest;

Look at the test/unit_tests/ directory for all unit-tests.

License

The code may be redistributed under the BSD 3-Clause license.

mexopencv's People

Contributors

amroamroamro avatar baekdahl avatar gnebehay avatar kyamagu avatar mljli avatar nextdesign1 avatar nsaje avatar rafaelgm avatar rokm avatar sapus avatar woreno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mexopencv's Issues

Error in compiling last version of mexopencv

I use mexopencv form September. I have a problem whit the last release; it's impossible compile it. The error is:

calcOpticalFlowPyrLK.cpp 
C:\Users\Super_Mario\Desktop\mexopencv-master\mexopencv-master\src+cv\calcOpticalFlowPyrLK.cpp(52) : error C2065: 'OPTFLOW_LK_GET_MIN_EIGENVALS': identificatore non dichiarato 

  C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'C:\Users\Super_Mario\Desktop\mexopencv-master\mexopencv-master\src+cv\calcOpticalFlowPyrLK.cpp' failed. 

Error using mex (line 206)
Unable to complete successfully.

Error in mexopencv.make (line 113)
            if ~opts.dryrun, eval(cmd); end

cv.stereoRectify issue

Everything compiled fine and all the examples work except for the calibration_demo example. When I run that demo I get the following error:

Error using cv.stereoRectify
Unexpected Standard exception from MEX file.
What() is:......\src\opencv\modules\imgproc\src\undistort.cpp:292: error: (-215) CV_IS_MAT(_distCoeffs) && (_distCoeffs->rows == 1
|| _distCoeffs->cols == 1) && (_distCoeffs->rows__distCoeffs->cols == 4 || _distCoeffs->rows__distCoeffs->cols == 5 ||
_distCoeffs->rows*_distCoeffs->cols == 8)

If I run a similar demo in C++ that uses stereoRectify, I don't see any errors, so that leads me to believe the problem is not in OpenCV. Any help would be appreciated!

Also, great work on this project!

cv.calibrateCamera

Hello,

I'm trying to use cv.calibrateCamera but I didn't make it. Matlab is crashing and it doesn't highlight any errors in the formula of cv.calibrateCamera.

I built objectPoints cell array like this:

object_points = cell(1, BOARD_W*BOARD_H, successful_boards);

where BOARD_W and BOARD_H are width and height of the chessboard; successful_boards represents the number of good boards in which i want to store objectpoints and corners.

I built image points cell array like this:

img_points_L = cell(1, BOARD_W*BOARD_H, successful_boards);
img_points_R = cell(1, BOARD_W*BOARD_H, successful_boards);

when I run calibrateCamera matlab crashes.

Any idea?

thanks

Invalid MEX-file when using cv functions

I used win 7 64 bit, matlab R 2012b and vs2010. The compilation passed, but it says the following error when using the cv functions:

Error using cv.cvtColor
Invalid MEX-file 'C:\Users(Username)\Documents\GitHub\mexOCV\mexopencv+cv\cvtColor.mexw64': The specified module
could not be found.

My opencv is stored in C:/opencv243, the version is 2.4.3.
The compiling cmd looks as follow and they all passed as I think:

mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\findContours.cpp lib\MxArray.obj -output +cv\findContours
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\findFundamentalMat.cpp lib\MxArray.obj -output +cv\findFundamentalMat
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\findHomography.cpp lib\MxArray.obj -output +cv\findHomography
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\fitEllipse.cpp lib\MxArray.obj -output +cv\fitEllipse
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\fitLine.cpp lib\MxArray.obj -output +cv\fitLine
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\floodFill.cpp lib\MxArray.obj -output +cv\floodFill
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\getAffineTransform.cpp lib\MxArray.obj -output +cv\getAffineTransform
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\getDerivKernels.cpp lib\MxArray.obj -output +cv\getDerivKernels
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\getGaussianKernel.cpp lib\MxArray.obj -output +cv\getGaussianKernel
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\getOptimalNewCameraMatrix.cpp lib\MxArray.obj -output +cv\getOptimalNewCameraMatrix
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\getPerspectiveTransform.cpp lib\MxArray.obj -output +cv\getPerspectiveTransform
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\getRectSubPix.cpp lib\MxArray.obj -output +cv\getRectSubPix
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv243\build\include" -L"C:\opencv243\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\getRotationMatrix2D.cpp lib\MxArray.obj -output +cv\getRotationMatrix2D

Thanks for your concerns.

Error in SparseMat to mxArray conversion

Hi kyamagu,

I was glad to use your opencv/mex conversion functions (MxArray.cpp, MxArray.hpp) in my own research, so thank you for this code. But as I understand there is an annoying bug in CompareSparseMatNode struct. Actually it must look like that:

{
        if (rhs->idx[1] < lhs->idx[1]) // column index
            return true;
        if (rhs->idx[1] == lhs->idx[1] && rhs->idx[0] < lhs->idx[0]) // row index
            return true;
        return false;
}

Invalid mex-file error when running compiled .exe code

I keep getting an error from all cv.* functions when executed from a MATLAB compiled .exe, even though they run fine from a MATLAB script.

Running:
MATLAB R2011.a (64-bit)
OpenCV 2.4.3
Compiled mexopencv in VS2010
Windows 7 (64-bit)

I installed OpenCV at C:/ and pointed the path at the correct /bin folder.
I compiled the mexopencv .mexw64 functions, cleaned them, set /D_SCL_SECURE = 1 flag and recompiled all .mex functions.
In my .m script I addpath(genpath('./mexopencv-master')) to guarantee the mex functions are searchable.
I then move the proper OpenCV DLL files into a folder at './DLLs', and programmatically add that folder to the environment path, so that it will work on a target machine when I move both the './.DLLs' and './mexopencv-master' folders with the .exe I build

When I run this setup from my .m script it runs perfect. No errors and correct results.
I then build a .exe using deploytool and include both the './DLLs' and './mexopencv-master' folders. The build works great. But if I move the .exe up to the same level as my 'main.m' script and run it on my development machine, it throws a Invalid MEX function at the first cv.* call. This is replicated when I move the .exe and required './DLLs' and './mexopencv-master' folders with it to a target machine with the MCR installed.

I am lost as to what the issue could be other than an incompatibility between the MCR and the compiled mex functions. The first function to throw it is GaussianBlur, but the very next call is threshold, which throws the same error.

FAST Corner Detection ( And others)

Mat in OpenCV starts from 0, while mat in matlab starts from 1.

It would be more reasonable to increase the values of keyponts.pt by 1 when copying the results back to matlab.

Thanks a lot.
(I tried to send you a email, but it cannot be reached. :-) )

Matlab crash when compiling with VS2008

Hi, kyamagu

I rebuilded opencv 2.4.3 with VS2008, set system path as C:\opencv\build\x86\vc9\bin and used matlab 2008a to compile mexopencv, but my matlab crashed. What's wrong?

Thanks.
Wu

Wrong parameters passed to cv.calcOpticalFlowPyrLK

In calcOpticalFlowPyrLK.cpp the OpenCV routine is called like

calcOpticalFlowPyrLK( ... , criteria, derivLambda, flags);

and the last two parameters are swaped, flags should go first. Because of that the threshold is zeroed out.

Furthermore, the default values for winSize and minEigThreshold are wrong. And for some reason minEigThreshold is called derivLambda and is not mentioned in the documentation.

mex error when running any cv code on Windows7

I was able to compile without any issue. I'm using Visual Studio 2008 as the compiler with opencv2.4.2. I took out the -D_SECURE_SCL from the matlab bat file. There were no compiling errors. I tried to run the sample facedetect and got the following error:

??? Invalid MEX-file
'C:<PATH_TO_MEXOPENCV>\mexopencv+cv\private\CascadeClassifier_.mexw32':
Invalid access to memory location.

Error in ==> CascadeClassifier>CascadeClassifier.CascadeClassifier at 33
            this.id = CascadeClassifier_(filename);

Error in ==> facedetect at 11
classifier = cv.CascadeClassifier(xml_file);

help cv

I'm using Matlab 64-bit on windows 7 64-bit, had successfully compile mex function, but when i tried to show list of function available using help cv; Matlab return enable pause function, not the list,.
can someone help solve this issue?
thanks in advanced,.

Invalid Mex-file

I am new to mex files and opencv, as a result I'm a little stuck. I'm getting "Invalid MEX-file" even after making sure the bat file had the D_SECURE_SCL set to 1.

When I noticed that the D_SECURE_SCL was set to 0. I changed it to 1 and then removed the existing mexopencv binaries. Once they were removed I recreated the mex function using the cv.make command.

If I type help cv I get a list encompassing ANN_MLP to watershed. But when I type

d = cv.imread(file_path);

I get the following:

Error using cv.imread
Invalid MEX-file
'C:\Users\mbarbumcinnis.SPRINGFIELD\Downloads\mexopencv-master\mexopencv-master+cv\imread.mexw64':
The specified module could not be found.

The file is in fact under that location. Not sure what else I could change...

Thanks!

Module not found

Hi,
I am trying to install mexopencv on windows 64 bit with visual studio10. I have installed opencv, visual studio. Done mex -setup in matlab to select the appropriate compiler. Whenever i try to run the sample program it says required module not found. Nothing wrong with the compilation.

When i used dependency walker it says libmx.dll, libmex.dll, opencv_core243, opencv_imgproc243.dll could not be found. But these files are present in the C:\opencv\build\x64\vc10\bin.

I have also added opencv path in mexopt.bat file but it still gives the same error.
Any help would be appreciated.

Thanks

Matlab2011b Crash with VS2010 in 32bit

I am using MATLAB 2011b on 32 bit Windows 7
with OpenCV 2.4.4 installed.

I am using Visual Studio 10 compiler.
I even edited the mexopts.bat file such that D_SECURE_SCL=1

I am able to build mexopencv and even able to view the help

SYSTEM path :
C:\Program Files\opencv\build\x86\vc10\bin;
C:\Program Files\opencv\build\x86\vc10\lib;

But when I ran

addpath('test');
UnitTest;

However, MatLab Crashes.

When I checked with Dependency Walker, there seems to be no error except LIBMX.DLL and LIBMEX.DLL

Could you help me to find the reason?

Please help.

Young

Win7 64 Bit; Matlab 2010a; VS 2008 --> Segmentation violation

I have the following Problem:

I get Segmentation violations for the mentioned configuration.
Trying to solve this did not work for me.
I used opencv_2.3.1 directly from repository and compiled it also VS 2008.

Do you have any Tips for getting closer to the solution?
I used the original code. I only had a problem with missing stdint.h. Here I found something on my disk from another open source.

Edit: here my Matlab test code:

>> load mandrill
>> im = cv.resize(X,0.5);

The problem comes up for every call to cv.*

Thanks a lot.


---
   Segmentation violation detected at Mon Apr 23 15:55:13 2012

---

Configuration:
  MATLAB Version:   7.10.0.499 (R2010a)
  MATLAB License:   894529
  Operating System: Microsoft Windows 7
  Window System:    Version 6.1 (Build 7601: Service Pack 1)
  Processor ID:     x86 Family 6 Model 15 Stepping 13, GenuineIntel
  Virtual Machine:  Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
  Default Encoding:  windows-1252

Fault Count: 1

Register State:
  rax = 0000214cccbd959c   rbx = 000000002d6395f0
  rcx = 000000002d6395b0   rdx = ffffffffff89a91c
  rbp = 00000000ffffffff   rsi = ffffffffff89a91c
  rdi = 0000000000000001   rsp = 000000000102a8a0
   r8 = 0000000000000000    r9 = 000000002d6395b0
  r10 = 0000000000000000   r11 = 000000000102ce40
  r12 = 000000002d6395b0   r13 = ffffffffff89a91c
  r14 = 0000000000000000   r15 = 000000000102d0f0
  rip = 000007fef0e260c3   flg = 0000000000010282

Stack Trace:
  [  0] 000007FEF0E260C3       opencv_core231.dll+286915 cv::merge+000323

used stdint.h:

// ISO C9x  compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 
// 
//  Copyright (c) 2006-2008 Alexander Chemeris
// 
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 
//   1. Redistributions of source code must retain the above copyright notice,
//      this list of conditions and the following disclaimer.
// 
//   2. Redistributions in binary form must reproduce the above copyright
//      notice, this list of conditions and the following disclaimer in the
//      documentation and/or other materials provided with the distribution.
// 
//   3. The name of the author may be used to endorse or promote products
//      derived from this software without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// 
///////////////////////////////////////////////////////////////////////////////
# ifndef _MSC_VER // [
# error "Use this header only with Microsoft Visual C++ compilers!"
# endif // _MSC_VER ]
# ifndef _MSC_STDINT_H_ // [
# define _MSC_STDINT_H_
# if _MSC_VER > 1000
# pragma once
# endif
# include <limits.h>

// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
//   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
# ifdef __cplusplus

extern "C" {
# endif
# include <wchar.h>
# ifdef __cplusplus

}
# endif

// Define _W64 macros to mark types changing their size, like intptr_t.
# ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
# endif

// 7.18.1 Integer types

// 7.18.1.1 Exact-width integer types

// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
# if (_MSC_VER < 1300)

   typedef signed char       int8_t;
   typedef signed short      int16_t;
   typedef signed int        int32_t;
   typedef unsigned char     uint8_t;
   typedef unsigned short    uint16_t;
   typedef unsigned int      uint32_t;
# else

   typedef signed __int8     int8_t;
   typedef signed __int16    int16_t;
   typedef signed __int32    int32_t;
   typedef unsigned __int8   uint8_t;
   typedef unsigned __int16  uint16_t;
   typedef unsigned __int32  uint32_t;
# endif

typedef signed __int64       int64_t;
typedef unsigned __int64     uint64_t;

// 7.18.1.2 Minimum-width integer types
typedef int8_t    int_least8_t;
typedef int16_t   int_least16_t;
typedef int32_t   int_least32_t;
typedef int64_t   int_least64_t;
typedef uint8_t   uint_least8_t;
typedef uint16_t  uint_least16_t;
typedef uint32_t  uint_least32_t;
typedef uint64_t  uint_least64_t;

// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t    int_fast8_t;
typedef int16_t   int_fast16_t;
typedef int32_t   int_fast32_t;
typedef int64_t   int_fast64_t;
typedef uint8_t   uint_fast8_t;
typedef uint16_t  uint_fast16_t;
typedef uint32_t  uint_fast32_t;
typedef uint64_t  uint_fast64_t;

// 7.18.1.4 Integer types capable of holding object pointers
# ifdef _WIN64 // [

   typedef signed __int64    intptr_t;
   typedef unsigned __int64  uintptr_t;
# else // _WIN64 ][

   typedef _W64 signed int   intptr_t;
   typedef _W64 unsigned int uintptr_t;
# endif // _WIN64 ]

// 7.18.1.5 Greatest-width integer types
typedef int64_t   intmax_t;
typedef uint64_t  uintmax_t;

// 7.18.2 Limits of specified-width integer types
# if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259

// 7.18.2.1 Limits of exact-width integer types
# define INT8_MIN     ((int8_t)_I8_MIN)
# define INT8_MAX     _I8_MAX
# define INT16_MIN    ((int16_t)_I16_MIN)
# define INT16_MAX    _I16_MAX
# define INT32_MIN    ((int32_t)_I32_MIN)
# define INT32_MAX    _I32_MAX
# define INT64_MIN    ((int64_t)_I64_MIN)
# define INT64_MAX    _I64_MAX
# define UINT8_MAX    _UI8_MAX
# define UINT16_MAX   _UI16_MAX
# define UINT32_MAX   _UI32_MAX
# define UINT64_MAX   _UI64_MAX

// 7.18.2.2 Limits of minimum-width integer types
# define INT_LEAST8_MIN    INT8_MIN
# define INT_LEAST8_MAX    INT8_MAX
# define INT_LEAST16_MIN   INT16_MIN
# define INT_LEAST16_MAX   INT16_MAX
# define INT_LEAST32_MIN   INT32_MIN
# define INT_LEAST32_MAX   INT32_MAX
# define INT_LEAST64_MIN   INT64_MIN
# define INT_LEAST64_MAX   INT64_MAX
# define UINT_LEAST8_MAX   UINT8_MAX
# define UINT_LEAST16_MAX  UINT16_MAX
# define UINT_LEAST32_MAX  UINT32_MAX
# define UINT_LEAST64_MAX  UINT64_MAX

// 7.18.2.3 Limits of fastest minimum-width integer types
# define INT_FAST8_MIN    INT8_MIN
# define INT_FAST8_MAX    INT8_MAX
# define INT_FAST16_MIN   INT16_MIN
# define INT_FAST16_MAX   INT16_MAX
# define INT_FAST32_MIN   INT32_MIN
# define INT_FAST32_MAX   INT32_MAX
# define INT_FAST64_MIN   INT64_MIN
# define INT_FAST64_MAX   INT64_MAX
# define UINT_FAST8_MAX   UINT8_MAX
# define UINT_FAST16_MAX  UINT16_MAX
# define UINT_FAST32_MAX  UINT32_MAX
# define UINT_FAST64_MAX  UINT64_MAX

// 7.18.2.4 Limits of integer types capable of holding object pointers
# ifdef _WIN64 // [
# define INTPTR_MIN   INT64_MIN
# define INTPTR_MAX   INT64_MAX
# define UINTPTR_MAX  UINT64_MAX
# else // _WIN64 ][
# define INTPTR_MIN   INT32_MIN
# define INTPTR_MAX   INT32_MAX
# define UINTPTR_MAX  UINT32_MAX
# endif // _WIN64 ]

// 7.18.2.5 Limits of greatest-width integer types
# define INTMAX_MIN   INT64_MIN
# define INTMAX_MAX   INT64_MAX
# define UINTMAX_MAX  UINT64_MAX

// 7.18.3 Limits of other integer types
# ifdef _WIN64 // [
# define PTRDIFF_MIN  _I64_MIN
# define PTRDIFF_MAX  _I64_MAX
# else  // _WIN64 ][
# define PTRDIFF_MIN  _I32_MIN
# define PTRDIFF_MAX  _I32_MAX
# endif  // _WIN64 ]
# define SIG_ATOMIC_MIN  INT_MIN
# define SIG_ATOMIC_MAX  INT_MAX
# ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX  _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX  _UI32_MAX
# endif // _WIN64 ]
# endif // SIZE_MAX ]

// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
# ifndef WCHAR_MIN // [
# define WCHAR_MIN  0
# endif  // WCHAR_MIN ]
# ifndef WCHAR_MAX // [
# define WCHAR_MAX  _UI16_MAX
# endif  // WCHAR_MAX ]
# define WINT_MIN  0
# define WINT_MAX  _UI16_MAX
# endif // __STDC_LIMIT_MACROS ]

// 7.18.4 Limits of other integer types
# if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260

// 7.18.4.1 Macros for minimum-width integer constants
# define INT8_C(val)  val##i8
# define INT16_C(val) val##i16
# define INT32_C(val) val##i32
# define INT64_C(val) val##i64
# define UINT8_C(val)  val##ui8
# define UINT16_C(val) val##ui16
# define UINT32_C(val) val##ui32
# define UINT64_C(val) val##ui64

// 7.18.4.2 Macros for greatest-width integer constants
# define INTMAX_C   INT64_C
# define UINTMAX_C  UINT64_C
# endif // __STDC_CONSTANT_MACROS ]
# endif // _MSC_STDINT_H_ ]

Invalid mex file even after changing SECURE_SCL flag

Hi,

I still get invalid mex file when accessing a simple function from mexopencv. I am using matlab2012a and VS2008. For testing i am trying to call a resize function but get following error:

Error using cv.resize
Invalid MEX-file 'F:\bio-fly\mexopencv+cv\resize.mexw32': Invalid access to memory
location.

If i do not change the SECURE_SCL flag then i get a crash (segmentation violation) which closes the matlab. Although after changing the flag now i get the error mentioned above. I have tried to rebuild my opencv from source that too did not help. I have compiled the opencv in VS2008 and set the SECURE_SCL=1 flag for each opencv project. Although those binaries result the same error. Would anyone please tell me what else is there to check?
Regards,

cv.cornerSubPix: error: (-210) Unexpected Standard exception from MEX file

I'm trying to use cv.cornerSubPix but I'm having some error:(-210).
I'm using it almost the same way it is used in the camera calibration sample.

This is my code:

    corners_left_ = cv.findChessboardCorners(image_left, [10, 7]);
    corners_left = cv.cornerSubPix(image_left, corners_left_);

where image_left is an RGB image (uint8) with the hole chessboard.

Error using cv.cornerSubPix
Unexpected Standard exception from MEX file.
What() is:/home/tiago/Downloads/OpenCV-2.4.3/modules/imgproc/src/cornersubpix.cpp:70: error: (-210) The source image must be 8-bit single-channel (CV_8UC1) in function cvFindCornerSubPix

For me it makes no sense using a single-channel image in cv.cornerSubPix and looking at the camera calibration sample, it is used an RGB image (uint8).

Incompatible library version - Invalid MEX File

I seem to be having an issue with a library version mismatch and can't seem to find the exact source of the error. I am currently running OSX 10.8/MATLAB 2012a/OpenCV 2.4.4 and when calling cv.imread I get this output in matlab:

Invalid MEX-file '/Users/Name/Dropbox/~Sensor
Fusion/Matlab/MexOpenCV/mexopencv/+cv/private/CascadeClassifier_.mexmaci64': dlopen(/Users/Name/Dropbox/~Sensor
Fusion/Matlab/MexOpenCV/mexopencv/+cv/private/CascadeClassifier_.mexmaci64, 1): Library not loaded:
/opt/local/lib/libfreetype.6.dylib
  Referenced from: /opt/local/lib/libavcodec.54.dylib
  Reason: Incompatible library version: libavcodec.54.dylib requires version 16.0.0 or later, but libfreetype.6.dylib
  provides version 10.0.0

I'd tried:

$ LD_PRELOAD=/usr/lib/libstdc++.so.6 matlab

With no luck. I've also tried:

$ locate libstdc++.so.6

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.
```

Any ideas?

Problem on Windows

>> cv.make('opencv_path', 'c:\OpenCV')

mex -c -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"c:\OpenCV\build\include" -L"c:\OpenCV\build\x64\vc10\lib"  src\MxArray.cpp -outdir lib
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"c:\OpenCV\build\include" -L"c:\OpenCV\build\x64\vc10\lib"  src+cv\CamShift.cpp lib\MxArray.obj -output +cv\CamShift
   Creating library C:\Users\Abbas\AppData\Local\Temp\mex_BPeaW2\templib.x and object C:\Users\Abbas\AppData\Local\Temp\mex_BPeaW2\templib.exp 
CamShift.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPEAX@Z) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release@Mat@cv@@QEAAXXZ) 
MxArray.obj : error LNK2001: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPEAX@Z) 
CamShift.obj : error LNK2019: unresolved external symbol "class cv::RotatedRect __cdecl cv::CamShift(class cv::Mat const &,class cv::Rect_<int> &,class cv::TermCriteria)" (?CamShift@cv@@YA?AVRotatedRect@1@AEBVMat@1@AEAV?$Rect_@H@1@VTermCriteria@1@@Z) referenced in function mexFunction 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::MatND::create(int,int const *,int)" (?create@MatND@cv@@QEAAXHPEBHH@Z) referenced in function "public: __cdecl cv::MatND::MatND(int,int const *,int)" (??0MatND@cv@@QEAA@HPEBHH@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::SparseMat::create(int,int const *,int)" (?create@SparseMat@cv@@QEAAXHPEBHH@Z) referenced in function "public: __cdecl cv::SparseMat::SparseMat(int,int const *,int)" (??0SparseMat@cv@@QEAA@HPEBHH@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::SparseMatConstIterator::SparseMatConstIterator(class cv::SparseMat const *)" (??0SparseMatConstIterator@cv@@QEAA@PEBVSparseMat@1@@Z) referenced in function "public: class cv::SparseMatConstIterator __cdecl cv::SparseMat::begin(void)const " (?begin@SparseMat@cv@@QEBA?AVSparseMatConstIterator@2@XZ) 
MxArray.obj : error LNK2019: unresolved external symbol "public: unsigned char \* __cdecl cv::SparseMat::ptr(int,int,bool,unsigned __int64 *)" (?ptr@SparseMat@cv@@QEAAPEAEHH_NPEA_K@Z) referenced in function "public: float & __cdecl cv::SparseMat::ref<float>(int,int,unsigned __int64 *)" (??$ref@M@SparseMat@cv@@QEAAAEAMHHPEA_K@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "void __cdecl cv::merge(class cv::Mat const *,unsigned __int64,class cv::Mat &)" (?merge@cv@@YAXPEBVMat@1@_KAEAV21@@Z) referenced in function "void __cdecl cv::merge(class std::vector<class cv::Mat,class std::allocator<class cv::Mat> > const &,class cv::Mat &)" (?merge@cv@@YAXAEBV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@AEAVMat@1@@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "void __cdecl cv::transpose(class cv::Mat const &,class cv::Mat &)" (?transpose@cv@@YAXAEBVMat@1@AEAV21@@Z) referenced in function "public: static void __cdecl cv::MatOp_T_<class cv::Mat>::apply(class cv::Mat const &,double,class cv::Mat &,int)" (?apply@?$MatOp_T_@VMat@cv@@@cv@@SAXAEBVMat@2@NAEAV32@H@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::convertTo(class cv::Mat &,int,double,double)const " (?convertTo@Mat@cv@@QEBAXAEAV12@HNN@Z) referenced in function "public: static void __cdecl cv::MatOp_T_<class cv::Mat>::apply(class cv::Mat const &,double,class cv::Mat &,int)" (?apply@?$MatOp_T_@VMat@cv@@@cv@@SAXAEBVMat@2@NAEAV32@H@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::Moments::Moments(double,double,double,double,double,double,double,double,double,double)" (??0Moments@cv@@QEAA@NNNNNNNNNN@Z) referenced in function "public: class cv::Moments __cdecl MxArray::toMoments(unsigned __int64)const " (?toMoments@MxArray@@QEBA?AVMoments@cv@@_K@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cv::format(char const *,...)" (?format@cv@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBDZZ) referenced in function "public: void __cdecl cv::Exception::formatMessage(void)" (?formatMessage@Exception@cv@@QEAAXXZ) 
MxArray.obj : error LNK2019: unresolved external symbol "public: class cv::SparseMatConstIterator & __cdecl cv::SparseMatConstIterator::operator++(void)" (??ESparseMatConstIterator@cv@@QEAAAEAV01@XZ) referenced in function "public: __cdecl MxArray::MxArray(class cv::SparseMat const &)" (??0MxArray@@QEAA@AEBVSparseMat@cv@@@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "void \* __cdecl cv::fastMalloc(unsigned __int64)" (?fastMalloc@cv@@YAPEAX_K@Z) referenced in function "public: void __cdecl cv::Mat::create(int,int,int)" (?create@Mat@cv@@QEAAXHHH@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "void __cdecl cv::split(class cv::Mat const &,class cv::Mat *)" (?split@cv@@YAXAEBVMat@1@PEAV21@@Z) referenced in function "void __cdecl cv::split(class cv::Mat const &,class std::vector<class cv::Mat,class std::allocator<class cv::Mat> > &)" (?split@cv@@YAXAEBVMat@1@AEAV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::MatND::convertTo(class cv::MatND &,int,double,double)const " (?convertTo@MatND@cv@@QEBAXAEAV12@HNN@Z) referenced in function "public: __cdecl MxArray::MxArray(class cv::MatND const &,enum mxClassID)" (??0MxArray@@QEAA@AEBVMatND@cv@@W4mxClassID@@@Z) 
C:\Users\Abbas\Documents\GitHub\mexopencv+cv\CamShift.mexw64 : fatal error LNK1120: 15 unresolved externals 

  C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Link of 'C:\Users\Abbas\Documents\GitHub\mexopencv+cv\CamShift.mexw64' failed. 

??? Error using ==> mex at 208
Unable to complete successfully.

Error in ==> make at 65
            eval(cmd);

Incorrectly ordered arguments for stereoRectify

I am not sure which version of stereoRectify that was previously used with the package, but currently OpenCV uses:

stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, 

and not:

stereoRectify(cameraMatrix1, cameraMatrix2, distCoeffs1, distCoeffs2,

like in the package.

Problems compiling and using mexopencv

Hi,

I have difficulties compiling and using mexopencv. I seek information on how to solve the problem.

I use openSUSE12.2 64 bit, gcc (SUSE Linux) 4.7.1, , opencv 2.4.1 and MATLABR2012b.
When I try to compile mexopencv, I, of course, get warnings:

...
Warning: You are using gcc version "4.7.1".  The version
         currently supported with MEX is "4.4.6".
         For a list of currently supported compilers see: 
         http://www.mathworks.com/support/compilers/current_release/
...

Is this a problem?

During compilation I get several errors, similar to:

...
/usr/local/MATLAB/R2012b//bin/mex -cxx -largeArrayDims -Iinclude -I/usr/include/opencv   src/+cv/private/FeatureDetector_.cpp -lMxArray -Llib /usr/lib64/libopencv_calib3d.so /usr/lib64/libopencv_contrib.so /usr/lib64/libopencv_core.so /usr/lib64/libopencv_features2d.so /usr/lib64/libopencv_flann.so /usr/lib64/libopencv_gpu.so /usr/lib64/libopencv_highgui.so /usr/lib64/libopencv_imgproc.so /usr/lib64/libopencv_legacy.so /usr/lib64/libopencv_ml.so /usr/lib64/libopencv_nonfree.so /usr/lib64/libopencv_objdetect.so /usr/lib64/libopencv_photo.so /usr/lib64/libopencv_stitching.so /usr/lib64/libopencv_ts.so /usr/lib64/libopencv_video.so /usr/lib64/libopencv_videostab.so   -o +cv/private/FeatureDetector_.mexa64

Warning: You are using gcc version "4.7.1".  The version
         currently supported with MEX is "4.4.6".
         For a list of currently supported compilers see: 
         http://www.mathworks.com/support/compilers/current_release/

src/+cv/private/FeatureDetector_.cpp:24:6: error: ‘FLOAT’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp:25:6: error: ‘UNSIGNED_INT’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp:26:6: error: ‘UINT64’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp:27:6: error: ‘SHORT’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp: In function ‘MxArray {anonymous}::get_param(const cv::Ptrcv::FeatureDetector&, const string&)’:
src/+cv/private/FeatureDetector_.cpp:44:29: error: ‘FLOAT’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp:45:65: error: no matching function for call to ‘cv::FeatureDetector::get(const string&) const’
src/+cv/private/FeatureDetector_.cpp:45:65: note: candidates are:
In file included from /usr/include/opencv2/opencv.hpp:47:0,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from src/+cv/private/FeatureDetector_.cpp:8:
/usr/include/opencv2/core/core.hpp:4293:65: note: template<class _Tp> typename cv::ParamType::member_type cv::Algorithm::get(const string&) const
/usr/include/opencv2/core/core.hpp:4293:65: note:   template argument deduction/substitution failed:
/usr/include/opencv2/core/core.hpp: In substitution of ‘template<class _Tp> typename cv::ParamType::member_type cv::Algorithm::get(const string&) const [with _Tp = float]’:
src/+cv/private/FeatureDetector_.cpp:45:65:   required from here
/usr/include/opencv2/core/core.hpp:4293:65: error: no type named ‘member_type’ in ‘struct cv::ParamType<float>’
/usr/include/opencv2/core/core.hpp:4294:65: note: template<class _Tp> typename cv::ParamType::member_type cv::Algorithm::get(const char_) const
/usr/include/opencv2/core/core.hpp:4294:65: note:   template argument deduction/substitution failed:
/usr/include/opencv2/core/core.hpp: In substitution of ‘template<class _Tp> typename cv::ParamType::member_type cv::Algorithm::get(const char_) const [with _Tp = float]’:
src/+cv/private/FeatureDetector_.cpp:45:65:   required from here
/usr/include/opencv2/core/core.hpp:4294:65: error: no type named ‘member_type’ in ‘struct cv::ParamType<float>’
src/+cv/private/FeatureDetector_.cpp:46:60: error: ‘SHORT’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp: In function ‘void {anonymous}::set_param(cv::Ptrcv::FeatureDetector&, const string&, MxArray)’:
src/+cv/private/FeatureDetector_.cpp:68:14: error: ‘class cv::FeatureDetector’ has no member named ‘setString’
src/+cv/private/FeatureDetector_.cpp:70:14: error: ‘class cv::FeatureDetector’ has no member named ‘setBool’
src/+cv/private/FeatureDetector_.cpp:71:61: error: ‘FLOAT’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp:72:14: error: ‘class cv::FeatureDetector’ has no member named ‘setDouble’
src/+cv/private/FeatureDetector_.cpp:73:60: error: ‘SHORT’ is not a member of ‘cv::Param’
src/+cv/private/FeatureDetector_.cpp:74:14: error: ‘class cv::FeatureDetector’ has no member named ‘setInt’
src/+cv/private/FeatureDetector_.cpp:76:14: error: ‘class cv::FeatureDetector’ has no member named ‘setMat’
src/+cv/private/FeatureDetector_.cpp:78:14: error: ‘class cv::FeatureDetector’ has no member named ‘setMatVector’

mex: compile of ' "src/+cv/private/FeatureDetector_.cpp"' failed.

make: **\* [+cv/private/FeatureDetector_.mexa64] Error 1
...

If I call a successfully compiled mex function from MATLAB, MATLAB crashes and I need to kill that process. I run MATLAB by preloading libraries:

LD_PRELOAD=/usr/lib64/libstdc++.so.6 matlab

Please let me know if I should supply additional information or how to solve this problem.

Thanks
aej

Matlab crashs when I use mexopencv

Hi,

I'm using the mexopencv in matlab. But i encountered a very tough problem:
When I use mexopencv in my matlab, the matlab will crashs and close. I wonder why?

I just install my mexopencv following the instruction given by this website. I download the mexopencv.zip file and compile it in the matlab 2010Ra with the compiler of VS2008. And my opencv edition is opencv2.4.2.

I can coompile the source file in src filefolder successfully, and generate all the mexwin32 file in +cv filefolder.

But when I use the mexopencv in matlab,the matlab will crash and close up. Such as:

a=cv.imread('cat.jpg')

I need your help urgently, and I will be very grateful if you can help me out. Thank you!

Compile Error

I expreienced errors when compilation process.I use opencv 2.4.4 matlab r2010a and visual studio 2010. What's wrong?

mex -largeArrayDims -D_SECURE_SCL=1 -I'C:\Users\oner\Desktop\mexopencv-2.4\include' -I'C:\opencv\build\include' -L'C:\opencv\build\x86\vc10\lib'  -lopencv_calib3d243 -lopencv_calib3d244 -lopencv_contrib243 -lopencv_contrib244 -lopencv_core243 -lopencv_core244 -lopencv_features2d243 -lopencv_features2d244 -lopencv_flann243 -lopencv_flann244 -lopencv_gpu243 -lopencv_gpu244 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_highgui244 -lopencv_imgproc243 -lopencv_imgproc244 -lopencv_legacy243 -lopencv_legacy244 -lopencv_ml243 -lopencv_ml244 -lopencv_nonfree243 -lopencv_nonfree244 -lopencv_objdetect243 -lopencv_objdetect244 -lopencv_photo243 -lopencv_photo244 -lopencv_stitching243 -lopencv_stitching244 -lopencv_ts243 -lopencv_ts244 -lopencv_video243 -lopencv_video244 -lopencv_videostab243 -lopencv_videostab244 -c 'C:\Users\oner\Desktop\mexopencv-2.4\src\MxArray.cpp' -outdir 'C:\Users\oner\Desktop\mexopencv-2.4\lib'
MxArray.cpp 
c:\program files (x86)\matlab\r2010a\extern\include\matrix.h(330) : error C2371: 'char16_t' : redefinition; different basic types 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\yvals.h(576) : see declaration of 'char16_t' 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(302) : warning C4344: behavior change: use of explicit template arguments results in call to 'T MxArray::at<int>(mwIndex) const' 
        with 
        [ 
            T=int 
        ] 
        but the regular function 'MxArray MxArray::at(const std::string &,mwIndex) const' is a better match 
        if you expect 'MxArray MxArray::at(const std::string &,mwIndex) const' to be called then you need to make it an explicit specialization 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(308) : warning C4344: behavior change: use of explicit template arguments results in call to 'T MxArray::at<double>(mwIndex) const' 
        with 
        [ 
            T=double 
        ] 
        but the regular function 'MxArray MxArray::at(const std::string &,mwIndex) const' is a better match 
        if you expect 'MxArray MxArray::at(const std::string &,mwIndex) const' to be called then you need to make it an explicit specialization 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(314) : warning C4344: behavior change: use of explicit template arguments results in call to 'T MxArray::at<bool>(mwIndex) const' 
        with 
        [ 
            T=bool 
        ] 
        but the regular function 'MxArray MxArray::at(const std::string &,mwIndex) const' is a better match 
        if you expect 'MxArray MxArray::at(const std::string &,mwIndex) const' to be called then you need to make it an explicit specialization 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(418) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(418) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(418) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(428) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data 
C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp(435) : warning C4344: behavior change: use of explicit template arguments results in call to 'T MxArray::at<int>(mwIndex) const' 
        with 
        [ 
            T=int 
        ] 
        but the regular function 'MxArray MxArray::at(const std::string &,mwIndex) const' is a better match 
        if you expect 'MxArray MxArray::at(const std::string &,mwIndex) const' to be called then you need to make it an explicit specialization 

  C:\PROGRA~2\MATLAB\R2010A\BIN\MEX.PL: Error: Compile of 'C:\USERS\ONER\DESKTOP\MEXOPE~1.4\SRC\MxArray.cpp' failed. 

??? Error using ==> mex at 222
Unable to complete successfully.

Error in ==> make at 81
        if ~opts.dryrun, eval(cmd); end

Segmentation Fault

Hello

I have some problems with this settings, I'm using matlabR2009b and OpenCV2.3 the compilation works after solvin the stdint.h issue, then I try this:

camera = cv.VideoCapture();
pause(2);
for i = 1:50
    % Capture frame
    frame = camera.read;
    imshow(frame);
    pause(0.3);
end

And get a segmentation fault, the problem is in the camera.read call.

After that I tried:

im = imread('img001.jpg');
 imshow(im);
gr = cv.cvtColor(im,'RGB2GRAY');

And get a segmentation fault in the cv.cvtColor call, seem that all the method calls produce a segmentation fault.

Best Regards

VideoCapture returns empty data

When running the VideoCapture class, it's returning empty or zero values. While calling the VideoCapture_ mex file directly gives the all the results. For example:

VideoCapture class:

>> cap = cv.VideoCapture('F:\DATA\walk-complex.avi');
>> pause(5);
>> cap.get('FPS')
ans =
 0
>> size(cap.read)
ans =
 0     0

VideoCapture_ mex:

>> cap = VideoCapture_('F:\DATA\walk-complex.avi');
>> pause(5);
>> VideoCapture_(cap, 'get', 'FPS')
ans =
25
>> size(VideoCapture_(cap, 'read'))
ans =
   120   160     3

cv.make error in Matlab 2012b with OpenCV 2.4.2 in Windows 7

Hello everybody. I installed the new version of Matlab and OpenCV and i get this error when i try to execute cv.make

>> cv.make
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\OpenCV\build\include" -L"C:\OpenCV\build\x64\vc10\lib" -lopencv_calib3d242 -lopencv_contrib242 -lopencv_core242 -lopencv_features2d242 -lopencv_flann242 -lopencv_gpu242 -lopencv_haartraining_engine -lopencv_highgui242 -lopencv_imgproc242 -lopencv_legacy242 -lopencv_ml242 -lopencv_nonfree242 -lopencv_objdetect242 -lopencv_photo242 -lopencv_stitching242 -lopencv_ts242 -lopencv_video242 -lopencv_videostab242  src+cv\CamShift.cpp lib\MxArray.obj -output +cv\CamShift
CamShift.cpp 
C:\Program Files\MATLAB\R2012b\extern\include\tmwtypes.h(821) : warning C4091: 'typedef ': ignorato a sinistra di 'wchar_t' quando non si dichiara alcuna variabile 
c:\program files\matlab\r2012b\extern\include\matrix.h(319) : error C4430: identificatore di tipo mancante, verr… utilizzato int. Nota: default-int non Š pi— supportato in C++ 

  C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'src+cv\CamShift.cpp' failed. 

Error using mex (line 206)
Unable to complete successfully.

Error in cv.make (line 64)
            eval(cmd);

Also if i compile a mex file everything goes well but when i execute it i get this error

Invalid MEX-file 'C:\Users\Maik\Documents\Elaborazione\Stage\freak\mexDenseFREAK.mexw64':
C:\Users\Maik\Documents\Elaborazione\Stage\freak\mexDenseFREAK.mexw64 non è un'applicazione di
Win32 valida.

I tried executing some OpenCV with Visual Studio and it works so i don't think that the problem is OpenCV

My mexopts.bat contains the following:

@echo off
rem MSVC100OPTS.BAT
rem
rem    Compile and link options used for building MEX-files
rem    using the Microsoft Visual C++ compiler version 10.0
rem
rem    $Revision: 1.1.6.4.2.1 $  $Date: 2012/07/12 13:53:59 $
rem    Copyright 2007-2009 The MathWorks, Inc.
rem
rem StorageVersion: 1.0
rem C++keyFileName: MSVC100OPTS.BAT
rem C++keyName: Microsoft Visual C++ 2010
rem C++keyManufacturer: Microsoft
rem C++keyVersion: 10.0
rem C++keyLanguage: C++
rem C++keyLinkerName: Microsoft Visual C++ 2010
rem C++keyLinkerVersion: 10.0
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************

set MATLAB=%MATLAB%
set VSINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio 10.0
set VCINSTALLDIR=%VSINSTALLDIR%\VC

set OPENCVDIR=C:\OpenCV

rem In this case, LINKERDIR is being used to specify the location of the SDK
set LINKERDIR=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\
set PATH=%VCINSTALLDIR%\bin\amd64;%VCINSTALLDIR%\bin;%VCINSTALLDIR%\VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%LINKERDIR%\bin\x64;%LINKERDIR%\bin;%MATLAB_BIN%;%PATH%
set INCLUDE=%OPENCVDIR%\build\include;%VCINSTALLDIR%\INCLUDE;%VCINSTALLDIR%\ATLMFC\INCLUDE;%LINKERDIR%\include;%INCLUDE%
set LIB=%OPENCVDIR%\build\x64\vc10\lib;%VCINSTALLDIR%\LIB\amd64;%VCINSTALLDIR%\ATLMFC\LIB\amd64;%LINKERDIR%\lib\x64;%MATLAB%\extern\lib\win64;%LIB%
set MW_TARGET_ARCH=win64

rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=cl
set COMPFLAGS=/c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
set OPTIMFLAGS=/O2 /Oy- /DNDEBUG
set DEBUGFLAGS=/Z7
set NAME_OBJECT=/Fo

rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win64\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opencv_calib3d242.lib opencv_contrib242.lib opencv_core242.lib opencv_features2d242.lib opencv_flann242.lib opencv_gpu242.lib opencv_haartraining_engine.lib opencv_imgproc242.lib opencv_highgui242.lib opencv_legacy242.lib opencv_ml242.lib opencv_nonfree242.lib opencv_objdetect242.lib opencv_photo242.lib opencv_stitching242.lib opencv_ts242.lib opencv_video242.lib opencv_videostab242.lib /nologo /manifest /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=@

rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=

set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp"
set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map"

Invalid Mex file.

I saw a lot of people had a similar issue, didn't help me though. I'm running a Matlab R2012a 64 bit on a 64 bit windows, with sdk 7.1 and VS10. I added the system path, C:\opencv\build\x64\vc10
I downloaded the mexopencv from the website, they talk about making something from opencv, but I'm not sure what they're talking about. All I did, downloaded opencv and mexopencv, run make.mexopencv on matlab. It seems okay, but when I try using one of the functions it doesn't work. what steps am I missing?

Thanks

Invalid MEX-file on Ubuntu 12.04

I get an invalid mex-file error but all my libraries are ok:

Example nbr 1:

run:
detector = cv.CascadeClassifier('haarcascade_frontalface_alt.xml');

output:

`Invalid MEX-file '/tmp/+cv/private/CascadeClassifier_.mexa64': /usr/local/lib/libopencv_highgui.so.2.4: undefined symbol:
_ZNK9QCheckBox15minimumSizeHintEv``

Example nbr 2:

run:

cv.imread

output:
Error using cv.imread Invalid MEX-file '/tmp/+cv/imread.mexa64': /usr/local/lib/libopencv_highgui.so.2.4: undefined symbol: _ZNK9QCheckBox15minimumSizeHintEv

Outout from ldd /usr/local/lib/libopencv_highgui.so.2.4:

linux-vdso.so.1 =>  (0x00007fff2436d000)
libopencv_core.so.2.4 => /usr/local/lib/libopencv_core.so.2.4 (0x00007ff54dd6c000)
libopencv_imgproc.so.2.4 => /usr/local/lib/libopencv_imgproc.so.2.4 (0x00007ff54d88b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff54d633000)
libGL.so.1 => /usr/lib/nvidia-current-updates/libGL.so.1 (0x00007ff54d316000)
libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007ff54d0c6000)
libpng12.so.0 => /share/pkgs/MATLAB/R2012b/bin/glnxa64/libpng12.so.0 (0x00007ff54cea0000)
libtiff.so.4 => /usr/lib/x86_64-linux-gnu/libtiff.so.4 (0x00007ff54cc3d000)
libjasper.so.1 => /usr/lib/x86_64-linux-gnu/libjasper.so.1 (0x00007ff54c9e6000)
libIlmImf.so.6 => /usr/lib/libIlmImf.so.6 (0x00007ff54c724000)
libHalf.so.6 => /usr/lib/libHalf.so.6 (0x00007ff54c4e1000)
libgstreamer-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstreamer-0.10.so.0 (0x00007ff54c1fa000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff54bfaa000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff54bcb5000)
libgstapp-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstapp-0.10.so.0 (0x00007ff54baa9000)
libgstvideo-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstvideo-0.10.so.0 (0x00007ff54b88c000)
libdc1394.so.22 => /usr/lib/x86_64-linux-gnu/libdc1394.so.22 (0x00007ff54b619000)
libv4l1.so.0 => /usr/local/lib/libv4l1.so.0 (0x00007ff54b413000)
libavcodec.so.54 => /usr/local/lib/libavcodec.so.54 (0x00007ff54a56f000)
libavformat.so.54 => /usr/local/lib/libavformat.so.54 (0x00007ff54a24c000)
libavutil.so.51 => /usr/local/lib/libavutil.so.51 (0x00007ff54a026000)
libswscale.so.2 => /usr/local/lib/libswscale.so.2 (0x00007ff549dda000)
libQtOpenGL.so.4 => /share/pkgs/MATLAB/R2012b/bin/glnxa64/libQtOpenGL.so.4 (0x00007ff549af0000)
libQtGui.so.4 => /share/pkgs/MATLAB/R2012b/bin/glnxa64/libQtGui.so.4 (0x00007ff548e12000)
libQtCore.so.4 => /share/pkgs/MATLAB/R2012b/bin/glnxa64/libQtCore.so.4 (0x00007ff548963000)
libQtTest.so.4 => /usr/lib/x86_64-linux-gnu/libQtTest.so.4 (0x00007ff54873d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff548441000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff548140000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff547f2a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff547b6b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff547953000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff54774b000)
libtbb.so.2 => /share/pkgs/MATLAB/R2012b/bin/glnxa64/libtbb.so.2 (0x00007ff54760c000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff54e44a000)
libnvidia-tls.so.304.64 => /usr/lib/nvidia-current-updates/tls/libnvidia-tls.so.304.64 (0x00007ff547408000)
libnvidia-glcore.so.304.64 => /usr/lib/nvidia-current-updates/libnvidia-glcore.so.304.64 (0x00007ff54501e000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff544cea000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007ff544ad8000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff5448d4000)
libImath.so.6 => /usr/lib/libImath.so.6 (0x00007ff5446cd000)
libIex.so.6 => /usr/lib/libIex.so.6 (0x00007ff5444ae000)
libIlmThread.so.6 => /usr/lib/libIlmThread.so.6 (0x00007ff5442a7000)
libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007ff5440a3000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007ff543d47000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007ff543b3f000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff543902000)
libgstbase-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstbase-0.10.so.0 (0x00007ff5436ae000)
liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007ff543433000)
libraw1394.so.11 => /usr/lib/x86_64-linux-gnu/libraw1394.so.11 (0x00007ff543223000)
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007ff543014000)
libv4l2.so.0 => /usr/local/lib/libv4l2.so.0 (0x00007ff542e08000)
libxvidcore.so.4 => /usr/lib/x86_64-linux-gnu/libxvidcore.so.4 (0x00007ff542ad0000)
libx264.so.128 => /usr/local/lib/libx264.so.128 (0x00007ff542747000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007ff542278000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007ff54204b000)
libtheoraenc.so.1 => /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 (0x00007ff541e0e000)
libtheoradec.so.1 => /usr/lib/x86_64-linux-gnu/libtheoradec.so.1 (0x00007ff541bf3000)
libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0x00007ff5419d6000)
libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0x00007ff54179c000)
libmp3lame.so.0 => /usr/lib/x86_64-linux-gnu/libmp3lame.so.0 (0x00007ff541512000)
libfaac.so.0 => /usr/lib/libfaac.so.0 (0x00007ff5412ff000)
libfreetype.so.6 => /share/pkgs/MATLAB/R2012b/bin/glnxa64/libfreetype.so.6 (0x00007ff541080000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007ff540e75000)
libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007ff540c6c000)
libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007ff540a66000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff54082f000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff540611000)
libv4lconvert.so.0 => /usr/local/lib/libv4lconvert.so.0 (0x00007ff54039c000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007ff540195000)
libexpat.so.1 => /share/pkgs/MATLAB/R2012b/bin/glnxa64/libexpat.so.1 (0x00007ff53ff6c000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff53fd69000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff53fb62000)

This is ubuntu 12.04 with opencv 2.4.4a.

Problem with keypoints matching algorithms

I am trying to use features extractor and descriptors to do the matching. I downloaded the Amsterdam Library of Object Images and tried to match the same object rotated by 20° using all the algorithms and the descriptors but when i use the matching i get too many matches (most of them wrong) and when i specify the distances Matlab gives a fatal exception and crashes. I post here the code used

a = imread(strcat('C:\Users\Maik\Documents\Elaborazione\IMMAGINI\', imA));
b = imread(strcat('C:\Users\Maik\Documents\Elaborazione\IMMAGINI\', imB));

ay = rgb2ycbcr(a);
by = rgb2ycbcr(b);

detector = cv.FeatureDetector('SIFT');
extractor = cv.DescriptorExtractor('SIFT');
matcher = cv.DescriptorMatcher('BruteForce');

k1 = detector.detect(ay(:,:,1));
k2 = detector.detect(by(:,:,1));
d1 = extractor.compute(ay(:,:,1), k1);
d2 = extractor.compute(by(:,:,1), k2);
matcher.add(d1);
matches = matcher.match(d2);

for the distance i switched to radiusMatch or i implemented myself to check distance

sometimes when i use bruteforce hamming i get

Unexpected Standard exception from MEX file.
What() is:......\src\opencv\modules\core\src\stat.cpp:1777: error: (-215) (type ==
CV_8U && dtype == CV_32S) || dtype == CV_32F

cv.threshold input para not work

I use the code 95da94e

clc;clear;
I = imread('church01.jpg');
I_gray = rgb2gray(I);
cornerStrength = cv.cornerHarris(I_gray, 'BlockSize', 3);
thresh = 0.0001;
dst = cv.threshold(cornerStrength, thresh, 'Method', 'BinaryInv', 'MaxValue', 255);
imshow(dst);

this code can't works.
but when I change to

dst = cv.threshold(cornerStrength, thresh, 'Method', 'BinaryInv');

it works.
I also check the file "mexopencv\src+cv\threshold.cpp", it did have MaxValue Options!
BTW, in the doc of cv.threshold, it write this input para as MaxVal.

Invalid MEX-file on Ubuntu 10.10

I'm getting:

Invalid MEX-file '/home/tiago/Documents/MATLAB/mexopencv/+cv/findChessboardCorners.mexa64': libopencv_calib3d.so.2.4: cannot open shared object file: No such file or directory.

even with:

LD_PRELOAD=/usr/lib/libstdc++.so.6 matlab

any idea of what's wrong?
I'm on Ubuntu 10.10, Matlab R2010b and opencv 2.4.3

Compilation errors: must #include <typeinfo> before using typeid

when compiling with gcc 4.4.5-8 (>=4.3?) you need to explicitly #include otherwise you get the following errors:

src/+cv/private/FeatureDetector_.cpp:69: error: must #include <typeinfo> before using typeid
src/+cv/private/DescriptorMatcher_.cpp:214: error: must #include <typeinfo> before using typeid

cv::Point_<T> always gets converted to mxDOUBLE_CLASS mxArray

In the current implementation of MxArray, when passing some of the templated OpenCV data types back to MATLAB from a MEX file, the conversion ignores the template type and creates a double array no matter what. Example:

create_point.cpp

#include "mexopencv.hpp"
using namespace std;
using namespace cv;
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    Point_<int> p(1,2);
    plhs[0] = MxArray(p);
}

MATLAB

>> p = create_point();
>> class(p)      % this is double

This implicit conversion can show up in unexpected places.. For example cv.approxPolyDP that takes a vector of int points, returns the approximated points as type double.

From what I can tell, this applies to Point_<T>, Point3_<T>, Size_<T>, Rect_<T>, Scalar_<T>, and possibly other places...

Do you think this should be fixed, or is this by design (possibly because some code depends on it somewhere else)?

Here is what I had in mind to fix the constructor:

template <typename T>
MxArray::MxArray(const cv::Point_<T>& p)
{
    p_ = mxCreateNumericMatrix(1, 2, ClassIDOf[DataType<T>::type], mxREAL);
    T *x = static_cast<T*>(mxGetData(p_));
    x[0] = p.x;
    x[1] = p.y;
}

where ClassIDOf is the same map defined in MxArray.cpp that translates opencv types to matlab types

Compilation failed

Hi, someone can help me. I have installed the opencv repository in my PC and I got the followings errors:

src/+cv/private/DescriptorMatcher_.cpp: In function ‘cv::Ptrcv::flann::IndexParams {anonymous}::createIndexParams(const MxArray&)’:
src/+cv/private/DescriptorMatcher_.cpp:124:16: error: ambiguous overload for ‘operator==’ in ‘p == 0l’
src/+cv/private/DescriptorMatcher_.cpp: In function ‘cv::Ptrcv::flann::IndexParams {anonymous}::createIndexParams(const MxArray&)’:
src/+cv/private/DescriptorMatcher_.cpp:124:16: error: ambiguous overload for ‘operator==’ in ‘p == 0l’
src/+cv/private/DescriptorMatcher_.cpp:124:16: note: candidates are:
src/+cv/private/DescriptorMatcher_.cpp:124:16: note: operator==(cv::flann::IndexParams_, cv::flann::IndexParams_) <built-in>
src/+cv/private/DescriptorMatcher_.cpp:124:16: note: operator==(const cv::flann::IndexParams_, const cv::flann::IndexParams_) <built-in>
.
.
.
src/+cv/private/DescriptorMatcher_.cpp: In function ‘cv::Ptrcv::DescriptorMatcher {anonymous}::createFlannBasedMatcher(const std::vector<MxArray>&)’:
src/+cv/private/DescriptorMatcher_.cpp:168:22: error: ambiguous overload for ‘operator==’ in ‘indexParams == 0l’
.
.
.
src/+cv/private/DescriptorMatcher_.cpp:170:23: error: ambiguous overload for ‘operator==’ in ‘searchParams == 0l’
.
.
.

I'm new in C/C++ and I don't understand the error. I search in google but I can't find a good explanation.

MATLAB2013a update and mexopencv failing

Hi,

I recently upgraded to MATLAB 2013a and now function which used to work are failing. (I've also updated the OS, so that might also be the problem)

For instance, cv.FeatureDetector is failing, from MATLAB:

Invalid MEX-file '/home/aej/Downloads/mexopencv/+cv/private/FeatureDetector_.mexa64':
/home/aej/Downloads/mexopencv/+cv/private/FeatureDetector_.mexa64: undefined symbol: _ZN2cv9Algorithm7setBoolERKSsb

Error in cv.FeatureDetector (line 88)
            this.id = FeatureDetector_(type);

Error in cal_test (line 119)
detector = cv.FeatureDetector('GFTT');

Please let me know if I should supply additional information. Thank you

MxArray: convert cv::Mat of type CV_8U to logical mxArray

Consider the following MEX function:

myFcn.cpp

#include "mexopencv.hpp"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    cv::Mat m(3, 3, CV_8U, cv::Scalar(255));    // 3x3 matrix filled with 255
    plhs[0] = MxArray(m, mxLOGICAL_CLASS);        // convert to logical MATLAB matrix
}

In MATLAB, this returns:

>> m = myFcn()
m =
   255   255   255
   255   255   255
   255   255   255

>> whos m
  Name      Size            Bytes  Class      Attributes
  m         3x3                 9  logical              

Even though the result is of type logical, the matrix contains values other than 0/1, which can cause some issues on comparison:

>> m(1) == true
ans =
     0
>> 1 == true
ans =
     1

The expected outcome should be:

>> m~=0
ans =
     1     1     1
     1     1     1
     1     1     1

Bug in KNearest_.cpp

KNearest_.cpp at line 86:

maxK = rhs[i].toInt();

should be

maxK = rhs[i+1].toInt();

Win7 x64, Matlab 64bit (r2011b), opencv2.4.2 (small .make change)

Hi kyamagu,

Awesome project, just started using it, with excellent results, much thanks!

I found that compiling mex files with a 64bit version of Matlab, on Windows 7 x64 required the Windows 7.1 SDK, not Visual Express 2010 (VC10 doesn't include a 64-bit compiler, so one needs the SDK to get the 64 bit compiler).
Also, as a note to anyone else struggling, I needed to use Matlab version r2011b, as I could never get r2011a to find the sdk.

Anyway, one small change to the make script allows for successful compilation:

elseif ~isempty(strfind(c.Name,'Microsoft SDK'))
        s = 'vc10';

(*side note: I'm using the x64 pre-built opencv binaries)

Invalid MEX-file

I am using MATLAB 2012 on 64 bit Windows 7 machine which has OpenCV 2.4 installed.

I am using Visual Studio 10 compiler.

I even edited the mexopts.bat file such that D_SECURE_SCL=1

I am able to build mexopencv and even able to view the help

 help cv.filter2D

filter2D  Convolves an image with the kernel
dst = cv.filter2D(src, kernel)
dst = cv.filter2D(src, kernel, 'Anchor', [0,1], ...)

But when I try and execute the function I get an error

dimg = cv.filter2D(img,kernel);
Error using cv.filter2D
Invalid MEX-file 'C:\opencv\matlab\trunk+cv\filter2D.mexw64': The specified module could not be
found.

Is there something I am missing out on.

Thanks,

Sid

Invalid mex file error

Hi,

I am using Ubuntu and MatlabR2012a. Can please tell what is the problem when I am using this code
cv.CascadeClassifier('haarcascade_frontalface_alt.xml')

I get the following error :

Invalid MEX-file '/u/mabbas/Desktop/face tracking/code/mexopencv/+cv/private/CascadeClassifier_.mexa64':
/proj/matlab/matlab2012a/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/libopencv_calib3d.so.2.3)

Error in cv.CascadeClassifier (line 33)
            this.id = CascadeClassifier_(filename);

thanks,

*.mexw64 is not a valid Win32 application

Hi, I'm having some trouble with my compiled mex files in Matlab. The compilation seems to work without any issues, but then when I try to call a function, I get the following error:

??? Error using ==> cv.resize
Invalid MEX-file '...\mexopencv-master\+cv\resize.mexw64':
...\mexopencv-master\+cv\resize.mexw64 is not a valid Win32 application.

The pathname is correct and the file is present and not empty. I'm using Matlab R2011a, on Windows 7, both 64-bit. When I do the compilation, the strings look like this:

mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv\build\include" -L"C:\opencv\build\x64\vc9\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src+cv\private\FeatureDetector_.cpp lib\MxArray.obj -output +cv\private\FeatureDetector_

When I type "help cv" I get a long list of functions and their usages, so that seems to be working well also. The only thing that looks a little funny is that the included library are in "vc9" instead of "vc10" - is that problematic?

Any ideas about what could be going wrong and how to fix it would be great! Thanks.

The error of matchShapes?

Thanks for kyanayu providing us with this powerful tool. But the code is in 54 row:

if (rhs[0].isNumeric() && rhs[1].isNumeric()) {
        Mat object1(rhs[0].toMat(CV_8U)), object2(rhs[0].toMat(CV_8U));
        double d = matchShapes(object1,object2,method,parameter);
        plhs[0] = MxArray(d);

Whether the objects2(rhs[0].toMat(CV_8U)) should change the objects2(rhs[1].toMat(CV_8U)) ?

`GLIBCXX_3.4.15' not found

I'm having this error while using cv.findChessboardCorners:

   Error using cv.findChessboardCorners
   Invalid MEX-file '/home/tiago/Documents/MATLAB/mexopencv/+cv/findChessboardCorners.mexa64': /usr/local/MATLAB/R2012b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by usr/local/lib/libopencv_calib3d.so.2.4)

I've tried to run matlab as:

LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab

but I got the same result...

I'm able to use some other mexopencv functions but not this one.
I'm on Ubuntu 12.04 LTS and running MATLAB r2012b

Stereo webcam system acquisition issue

I'm trying to setup a stereo system but I'm having trouble capturing from both devices.

I'm able to read from both webcams, one at a time, I mean with a single videoCapture object at a time (create a videoCapture object, capture a frame, delete the object, create a new one for the other webcam and capture a frame).

When I create two videoCapture objects, one for each webcam, I'm able to read from the first one but from the second I get a null frame.

Any ideas?
I'm on Ubuntu 12.04 LTS and running MATLAB r2012b

problem ... Invalid MEX-file ....

win7 x64
matlab 2012a x64
win sdk
vs2010
OpenCV-2.4.3 (http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.3/)
add D:\lib\opencv\build\x64\vc10\bin to system path

build with the commands in "README.markdown"
cv.make('opencv_path', 'D:\lib\opencv')

build seems fine:

mex -c -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"D:\lib\opencv\build\include" -L"D:\lib\opencv\build\x64\vc10\lib" -lopencv_calib3d243 -lopencv_contrib243 -lopencv_core243 -lopencv_features2d243 -lopencv_flann243 -lopencv_gpu243 -lopencv_haartraining_engine -lopencv_highgui243 -lopencv_imgproc243 -lopencv_legacy243 -lopencv_ml243 -lopencv_nonfree243 -lopencv_objdetect243 -lopencv_photo243 -lopencv_stitching243 -lopencv_ts243 -lopencv_video243 -lopencv_videostab243  src\MxArray.cpp -outdir lib

but when test with:

addpath('test');
UnitTest;
UnitTest;
== TestANN_MLP ======
-- test_1 ------
Invalid MEX-file 'D:\lib\matlab_lib\mexopencv+cv\private\ANN_MLP_.mexw64': ?????????
Error in cv.ANN_MLP (line 113)
        this.id = ANN_MLP_();
Error in TestANN_MLP.test_1 (line 10)
            classifier = cv.ANN_MLP([3,1]);
Error in UnitTest.all (line 47)
                    feval([class_name,'.',m{:}]);
Error in UnitTest (line 21)
                UnitTest.all(class_name);
FAIL

VideoCapture is not Locked

Using the clear function of Matlab (e.g. clear all) hangs Matlab. Probably because Matlab is trying to unload the FFMPEG DLL in OpenCV. The solution to prevent this is, is to Lock the MEX file. So add the next lines to src/+cv/private/VideoCapture_.cpp after mexFunction:


// Unload is dangerous when video's are open
if (!mexIsLocked())
   mexLock();

Matlab 64 bit Windows 7 compilation error when linking against self-compiled OpenCV

After reading previous issues and solutions, I did the following

1)Downloaded OpenCV(2.4.2) into C:\opencv
2)Downloaded mexopencv
3)Built OpenCV using VC++ 2008 Express edition. Successfully built both debug and release versions with /D "_SECURE_SCL=1" option entered in Configuration Properties>C/C++>Command Line>Additional Options
4)Replaced the lib files in C:\opencv\build\x64\vc9\lib with the new lib files both debug and release from the build.
5)Replaced the dll files in C:\opencv\build\x64\vc9\bin for both debug and release with the new dlls for both debug and release from the build.

6)in Matlab entered command cv.make

Now I get the below error:


>> cv.make
mex -c -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv\build\include" -L"C:\opencv\build\x64\vc9\lib" -lopencv_calib3d242 -lopencv_contrib242 -lopencv_core242 -lopencv_features2d242 -lopencv_flann242 -lopencv_gpu242 -lopencv_haartraining_engine -lopencv_highgui242 -lopencv_imgproc242 -lopencv_legacy242 -lopencv_ml242 -lopencv_nonfree242 -lopencv_objdetect242 -lopencv_photo242 -lopencv_stitching242 -lopencv_ts242 -lopencv_video242 -lopencv_videostab242  src\MxArray.cpp -outdir lib
mex -largeArrayDims -D_SECURE_SCL=1 -Iinclude -I"C:\opencv\build\include" -L"C:\opencv\build\x64\vc9\lib" -lopencv_calib3d242 -lopencv_contrib242 -lopencv_core242 -lopencv_features2d242 -lopencv_flann242 -lopencv_gpu242 -lopencv_haartraining_engine -lopencv_highgui242 -lopencv_imgproc242 -lopencv_legacy242 -lopencv_ml242 -lopencv_nonfree242 -lopencv_objdetect242 -lopencv_photo242 -lopencv_stitching242 -lopencv_ts242 -lopencv_video242 -lopencv_videostab242  src+cv\CamShift.cpp lib\MxArray.obj -output +cv\CamShift
   Creating library C:\USERS\CZX\APPDATA\LOCAL\TEMP\MEX_TC~1\templib.x and object C:\USERS\CZX\APPDATA\LOCAL\TEMP\MEX_TC~1\templib.exp 
CamShift.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QEAAXXZ) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release@Mat@cv@@QEAAXXZ) 
MxArray.obj : error LNK2001: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QEAAXXZ) 
CamShift.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPEAX@Z) referenced in function "public: __cdecl cv::Mat::~Mat(void)" (??1Mat@cv@@QEAA@XZ) 
MxArray.obj : error LNK2001: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPEAX@Z) 
CamShift.obj : error LNK2019: unresolved external symbol "class cv::RotatedRect __cdecl cv::CamShift(class cv::_InputArray const &,class cv::Rect_<int> &,class cv::TermCriteria)" (?CamShift@cv@@YA?AVRotatedRect@1@AEBV_InputArray@1@AEAV?$Rect_@H@1@VTermCriteria@1@@Z) referenced in function mexFunction 
CamShift.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::_InputArray::_InputArray(class cv::Mat const &)" (??0_InputArray@cv@@QEAA@AEBVMat@1@@Z) referenced in function mexFunction 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::SparseMat::create(int,int const *,int)" (?create@SparseMat@cv@@QEAAXHPEBHH@Z) referenced in function "public: __cdecl cv::SparseMat::SparseMat(int,int const *,int)" (??0SparseMat@cv@@QEAA@HPEBHH@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::SparseMatConstIterator::SparseMatConstIterator(class cv::SparseMat const *)" (??0SparseMatConstIterator@cv@@QEAA@PEBVSparseMat@1@@Z) referenced in function "public: class cv::SparseMatConstIterator __cdecl cv::SparseMat::begin(void)const " (?begin@SparseMat@cv@@QEBA?AVSparseMatConstIterator@2@XZ) 
MxArray.obj : error LNK2019: unresolved external symbol "public: unsigned char \* __cdecl cv::SparseMat::ptr(int,int,bool,unsigned __int64 *)" (?ptr@SparseMat@cv@@QEAAPEAEHH_NPEA_K@Z) referenced in function "public: float & __cdecl cv::SparseMat::ref<float>(int,int,unsigned __int64 *)" (??$ref@M@SparseMat@cv@@QEAAAEAMHHPEA_K@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::create(int,int const *,int)" (?create@Mat@cv@@QEAAXHPEBHH@Z) referenced in function "public: __cdecl cv::Mat::Mat(int,int const *,int)" (??0Mat@cv@@QEAA@HPEBHH@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::copySize(class cv::Mat const &)" (?copySize@Mat@cv@@QEAAXAEBV12@@Z) referenced in function "public: __cdecl cv::Mat::Mat(class cv::Mat const &)" (??0Mat@cv@@QEAA@AEBV01@@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::Moments::Moments(double,double,double,double,double,double,double,double,double,double)" (??0Moments@cv@@QEAA@NNNNNNNNNN@Z) referenced in function "public: class cv::Moments __cdecl MxArray::toMoments(unsigned __int64)const " (?toMoments@MxArray@@QEBA?AVMoments@cv@@_K@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::convertTo(class cv::_OutputArray const &,int,double,double)const " (?convertTo@Mat@cv@@QEBAXAEBV_OutputArray@2@HNN@Z) referenced in function "public: __cdecl MxArray::MxArray(class cv::Mat const &,enum mxClassID,bool)" (??0MxArray@@QEAA@AEBVMat@cv@@W4mxClassID@@_N@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::_OutputArray::_OutputArray(class cv::Mat &)" (??0_OutputArray@cv@@QEAA@AEAVMat@1@@Z) referenced in function "public: __cdecl MxArray::MxArray(class cv::Mat const &,enum mxClassID,bool)" (??0MxArray@@QEAA@AEBVMat@cv@@W4mxClassID@@_N@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::Mat::Mat(int,int const *,int,void *,unsigned __int64 const *)" (??0Mat@cv@@QEAA@HPEBHHPEAXPEB_K@Z) referenced in function "public: __cdecl MxArray::MxArray(class cv::Mat const &,enum mxClassID,bool)" (??0MxArray@@QEAA@AEBVMat@cv@@W4mxClassID@@_N@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "void __cdecl cv::split(class cv::Mat const &,class std::vector<class cv::Mat,class std::allocator<class cv::Mat> > &)" (?split@cv@@YAXAEBVMat@1@AEAV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@@Z) referenced in function "public: __cdecl MxArray::MxArray(class cv::Mat const &,enum mxClassID,bool)" (??0MxArray@@QEAA@AEBVMat@cv@@W4mxClassID@@_N@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: class cv::MatExpr __cdecl cv::Mat::t(void)const " (?t@Mat@cv@@QEBA?AVMatExpr@2@XZ) referenced in function "public: __cdecl MxArray::MxArray(class cv::Mat const &,enum mxClassID,bool)" (??0MxArray@@QEAA@AEBVMat@cv@@W4mxClassID@@_N@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "void __cdecl cv::merge(class std::vector<class cv::Mat,class std::allocator<class cv::Mat> > const &,class cv::_OutputArray const &)" (?merge@cv@@YAXAEBV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@AEBV_OutputArray@1@@Z) referenced in function "public: class cv::Mat __cdecl MxArray::toMat(int,bool)const " (?toMat@MxArray@@QEBA?AVMat@cv@@H_N@Z) 
MxArray.obj : error LNK2019: unresolved external symbol "public: class cv::SparseMatConstIterator & __cdecl cv::SparseMatConstIterator::operator++(void)" (??ESparseMatConstIterator@cv@@QEAAAEAV01@XZ) referenced in function "public: __cdecl MxArray::MxArray(class cv::SparseMat const &)" (??0MxArray@@QEAA@AEBVSparseMat@cv@@@Z) 
C:\CZX\WORK\MEXOPE~1_CV~1\CamShift.mexw64 : fatal error LNK1120: 17 unresolved externals 

  C:\PROGRA~1\MATLAB\R2008B\BIN\MEX.PL: Error: Link of 'C:\CZX\WORK\MEXOPE~1_CV~1\CamShift.mexw64' failed. 

??? Error using ==> mex at 213
Unable to complete successfully.

Error in ==> make at 65
            eval(cmd);
  1. I tried deleting MxArray.obj in mexopencv\lib to make sure it gets compiled again (even after cv.make('clean')
  2. The above compilation error occurs when I link against the self compiled OpenCV libraries and dlls. If I link against the default OpenCV lib (before replacing with the selfcompiled files in C:\opencv\build\x64\vc9\lib ) it compiles successfully. But when I execute any commands (e.g. camera = cv.VideoCapture;) I get the below error.
??? Invalid MEX-file 'c:\czx\work\mexopencv+cv\private\VideoCapture_.mexw64': The specified module could not be found.
Error in ==> VideoCapture>VideoCapture.VideoCapture at 46
            this.id = VideoCapture_(filename);
  1. The main reason I did the build of OpenCV code with \D "SECURE_SCL=1" option was to solve the above error. But it resulted in compilaton error.

Any hints would be really appreciated. Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.