I tried compiling following piece of code with “mex”.
Matlab version: R2011a
C++ Compiler: Visual Studio 2010
//test.cpp
#include "mex.h"
#include <vector>
#include <opencvcv.h>
void mexFunction(int nlhs, mxArray *plhs[],int nrhs, mxArray *prhs[])
{
int size[]={100,100,3};
const std::vector<cv::Mat> chans(size[2],cv::Mat(size[0],size[1],CV_64F));
cv::Mat opencv;
cv::merge(chans,opencv);
return ;
}
This compiles fine. But crashes Matlab, if you run “test” in Matlab. In debug mode (“mex” with -g), leads to an assertions failure !
It seems that “cv::merge(chans,opencv);” lead the crash of the program.I’ve get the same proplem when I use the function “merge()”.Did you find the solution to this problem, If so,Email me
as soon as possible,please.