High-quality-ellipse-detection
High-quality-ellipse-detection copied to clipboard
Problem building mex files
Hi. I openCV2.4.9 installed in D:\OpenCV directory. The command I used was the following:
mex generateEllipseCandidates.cpp -ID:\OpenCV\opencv\build\include -ID:\OpenCV\opencv\build\include\opencv -ID:\OpenCV\opencv\build\include\opencv2 -LD:\OpenCV\opencv\build\x64\vc11\lib -LC:\Program Files\MATLAB\R2018b\extern\include -LC:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.libmex
but I'm getting this error: Error using mex C:\High-quality-ellipse-detection-master\Files\MATLAB\R2018b\extern\include not found; check that you are in the correct current folder, and check the spelling of 'C:\High-quality-ellipse-detection-master\Files\MATLAB\R2018b\extern\include'.
Hi, I guess that the command you entered might not correct. The true one is as follow:
mex generateEllipseCandidates.cpp -ID:\OpenCV\opencv\build\include -ID:\OpenCV\opencv\build\include\opencv -ID:\OpenCV\opencv\build\include\opencv2 -LD:\OpenCV\opencv\build\x64\vc11\lib -LC:\Program Files\MATLAB\R2018b\extern\include -LC:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.lib
Please try again.
Still not working. For a reason mex is looking for a folder "Files" inside the project folder
Ok, please check whether each folder containing the corresponding lib files. For example, it should have lib file "opencv_core249" in the folder "D:\OpenCV\opencv\build\x64\vc11\lib" and should have "libmwlapack.lib" in the "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft". In addition, please check whether each entered path exists or not.
And the current working directory of MATLAB should also be same as the directory of source code.
Thanks for your reply but the problem still persist. I've checked the libraries path and everything is ok. Maybe is my matlab version. I'll try it in a different version
My MATLAB version is R2016b.
Do not forget to set the path in quotes if it contains spaces! Please try: mex generateEllipseCandidates.cpp -ID:\OpenCV\opencv\build\include -ID:\OpenCV\opencv\build\include\opencv -ID:\OpenCV\opencv\build\include\opencv2 -LD:\OpenCV\opencv\build\x64\vc11\lib -L'C:\Program Files\MATLAB\R2018b\extern\include' -L'C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft' -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.lib
@JosePizarro Yes, it's suggested that the software path does not contain the blank space. Otherwise, it should use the quotation marks to enclose the entered path. Thanks, @Wuranker
Hi. I openCV2.4.9 installed in C:\Users\Administrator\Desktop directory. The command I used was the following:
mex generateEllipseCandidates.cpp -IC:\Users\Administrator\Desktop\OpenCV\opencv2.4.9\build\include -IC:\Users\Administrator\Desktop\OpenCV\opencv2.4.9\build\include\opencv -LC:\Users\Administrator\Desktop\OpenCV\opencv2.4.9\build\x64\vc11\lib -L**'IC:\Program Files\MATLAB\MATLAB Runtime\v90\extern\include'** -L**'IC:\Program Files\MATLAB\MATLAB Runtime\v90\extern\lib\win64\microsoft'** -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.lib
but I'm getting this error: 警告: MEX 找不到库 'opencv_core249'。将默认设置为 'libopencv_core249.lib'。 警告: MEX 找不到库 'opencv_highgui249'。将默认设置为 'libopencv_highgui249.lib'。 警告: MEX 找不到库 'opencv_imgproc249'。将默认设置为 'libopencv_imgproc249.lib'。 使用 'Microsoft Windows SDK 7.1 (C++)' 编译。 错误使用 mex LINK : fatal error LNK1181: cannot open input file 'libopencv_core249.lib'
so could you give me some advice?
Hi, justiner. I guess your command may be incorrect. For example,
-L**'IC:\Program Files\MATLAB\MATLAB Runtime\v90\extern\include'** -L**'IC:\Program Files\MATLAB\MATLAB Runtime\v90\extern\lib\win64\microsoft'**
should be replaced by
-I'C:\Program Files\MATLAB\MATLAB Runtime\v90\extern\include' -L'C:\Program Files\MATLAB\MATLAB Runtime\v90\extern\lib\win64\microsoft'
Please read the instructions and answer #4 carefully.
The problem has been solved! Thank you all!
Hi, justiner. I guess your command may be incorrect. For example,
-L**'IC:\Program Files\MATLAB\MATLAB Runtime\v90\extern\include'** -L**'IC:\Program Files\MATLAB\MATLAB Runtime\v90\extern\lib\win64\microsoft'**
should be replaced by
-I'C:\Program Files\MATLAB\MATLAB Runtime\v90\extern\include' -L'C:\Program Files\MATLAB\MATLAB Runtime\v90\extern\lib\win64\microsoft'
Please read the instructions and answer #4 carefully.
Thanks for your guide,Thank you very much !
@justinner I believe that the problem is in the location of your MATLAB folder. mex is unable to access files from Program Files. Hence, for a simple hack I copied the MATLAB folder to C drive, provide a new location and you will be able to compile it successfully.
I ran the following command:
mex generateEllipseCandidates.cpp -IC:\opencv\build\include -IC:\opencv\build\include\opencv -IC:\opencv\build\include\opencv2 -LC:\opencv\build\x64\vc11\lib -IC:\Users\jaimeetp\Documents\MATLAB\R2019a\extern\include -LC:\Users\jaimeetp\Documents\MATLAB\R2019a\extern\lib\win64\microsoft -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.lib
Hi I am getting this error can anyone tell me what is the issue ?
Error using mex C:\opencv\build\x64\vc11\lib\opencv_core249.lib: error adding symbols: File in wrong format collect2.exe: error: ld returned 1 exit status
I ran this command :
mex generateEllipseCandidates.cpp -IC:\opencv\build\include -IC:\opencv\build\include\opencv -IC:\opencv\build\include\opencv2 -LC:\opencv\build\x64\vc11\lib -I'C:\Program Files\Polyspace\R2019a\extern\include' -L'C:\Program Files\Polyspace\R2019a\extern\lib\win64\microsoft' -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.lib
Hi, I guess that the command you entered might not correct. The true one is as follow:
mex generateEllipseCandidates.cpp -ID:\OpenCV\opencv\build\include -ID:\OpenCV\opencv\build\include\opencv -ID:\OpenCV\opencv\build\include\opencv2 -LD:\OpenCV\opencv\build\x64\vc11\lib -LC:\Program Files\MATLAB\R2018b\extern\include -LC:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.lib
Please try again. Hi,when I compile the file "generateEllipseCandidates.cpp" in MATLAB on my computer to generate the mex file "generateEllipseCandidates.mexw64" with the following command: mex generateEllipseCandidates.cpp -ID:\Sofaware\Opencv2.4.9\opencv\build\include -ID:\Sofaware\Opencv2.4.9\opencv\build\include\opencv -ID:\Sofaware\Opencv2.4.9\opencv\build\include\opencv2 -LD:\Sofaware\Opencv2.4.9\opencv\build\x64\vc11\lib -ID:\matlab2012b\extern\include -LD:\matlab2012b\extern\lib\win64\microsoft -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -llibmwlapack.lib
There is an error as following: generateEllipseCandidates.obj : error LNK2019: 无法解析的外部符号 dggev,该符号在函数 "int __cdecl fitEllipse(struct point2d *,int,double *)" (?fitEllipse@@YAHPEAUpoint2d@@HPEAN@Z) 中被引用 generateEllipseCandidates.mexw64 : fatal error LNK1120: 1 个无法解析的外部命令
So, can you give me some suggestions?