Question

I have been at this for 2 days and have tried every possible solution I can find via a search engine. But I still am stuck here.

I downloaded a package for superpixel implementation from here.

The function is in C++, but a mex file has been generated for a Linux 64 bit OS. Am using Windows 8 64 bit, so I have to generate one mex file for my system.

The files are already provided in the package from the site. After mex setup and providing proper openCV paths and environment variables, I ran the code compile_mex.m

mex -IB:\Opencv\opencv\build\include\opencv -c seeds2.cpp

mex mexSEEDS.cpp -IB:\Opencv\opencv\build\include\opencv seeds2.obj

And I get the following error, for which am not able to arrive at a solution

mexSEEDS.obj : error LNK2019: unresolved external symbol cvSaveImage referenced in function "void __cdecl SaveImage(unsigned int *,int const &,int const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?SaveImage@@YAXPEAIAEBH1AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

I have not been able to pass through this. I got the same error when I executed this in codeblocks, even after linking the libraires, compiler directories and the linker libraires and directories as suggested by many sites/forums.

Was it helpful?

Solution

I got the answer.

  1. Locate and open mexopts.bat
  2. access this pdf
  3. Follow from SETTING MATLAB TO COMPILE C++ AND MATLAB MEX FILES AND LINK THEM WITH OPENCV OBJ FILES
  4. while editing mexopts.bat, in adding libraries to LINKFLAGS, add the following libraries from /build/x64/vc10/lib

    core249 and 249d
    flann249 (and the same as above. rest also have the tag 249 and 249d. this is the version number. 2.4.9 in my case)
    highgui
    imageproc
    legacy
    objdetect
    

The reason is all these were required to compile mexseeds.cpp. But the basic is atleast the 1st 4. after adding save and compile the mex file. In the pdf, the library names will be different, since it was created during the older versions of opencv

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top