ihpdep / LDES

[AAAI19] Robust Estimation of Similarity Transformation for Visual Object Tracking
MIT License
108 stars 24 forks source link

When I run demo.m, I came into the error of "mpolar function undefined". #1

Open soldatjiang opened 5 years ago

soldatjiang commented 5 years ago

I recompiled the utility/mpolar.cpp with mex using VS2015 and opencv3.4.3, and I came into the following error

错误使用 mex
mpolar.cpp
d:\jiangshan\open_source\ldes\utility\opencv_matlab.hpp(233): warning C4244: “=”: 从“double”转换到“float”,可能丢失数据
D:\JiangShan\open_source\LDES\utility\mpolar.cpp(28): error C2440: “初始化”: 无法从“const size_t *”转换为“const int *”
D:\JiangShan\open_source\LDES\utility\mpolar.cpp(28): note: 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
D:\JiangShan\open_source\LDES\utility\mpolar.cpp(29): warning C4267: “初始化”: 从“size_t”转换到“int”,可能丢失数据
D:\JiangShan\open_source\LDES\utility\mpolar.cpp(29): warning C4267: “初始化”: 从“size_t”转换到“const int”,可能丢失数据

Then I modified line 28 of mpolar.cpp like this:

const int *dimsA    = (const int*)mxGetDimensions(prhs[0]);

I successfully compiled mpolar.cpp, but when I ran demo.m again, it threw the following exception:

MEX 文件出现意外的标准异常。
What() 是: OpenCV(3.4.3) C:\build\3_4_winpack-build-win64-vc14\opencv\modules\core\src\matrix_c.cpp:181: error: (-5:Bad argument) Unknown array type
in function 'cv::cvarrToMat'

。.

There are no problem with other mex files.

ihpdep commented 5 years ago

Thanks for your comment @soldatjiang . I have updated the files and tested the code with OpenCV 2.4 in Windows. I upload the mpolar.mexw64. Would you please try again and let me know whether it works with OpenCV 3?

soldatjiang commented 5 years ago

I tested the code and put opencv_core2413.dll and opencv_imgproc2413.dll in the root directory and it works. You can include these two dlls in your repository so that others can run your code without any configuration. I will test it with OpenCV 3 soon.

ihpdep commented 5 years ago

I tested the code and put opencv_core2413.dll and opencv_imgproc2413.dll in the root directory and it works. You can include these two dlls in your repository so that others can run your code without any configuration. I will test it with OpenCV 3 soon.

Thanks, @soldatjiang . The dll files should be in the environment path when OpenCV is installed properly. I will keep it without dll since it is platform-specific.

soldatjiang commented 5 years ago

I recompiled all mex files with OpenCV 3 and it works properly. Here is my compile script on my windows 7 x64 machine.

include_path = ['-I','D:\Program Files\opencv343\build\include'];
link_lib = fullfile('D:\Program Files\opencv343\build\x64\vc14\lib','opencv_world343.lib');
mex('-v',include_path,'mexResize.cpp','MxArray.cpp',link_lib)
mex('-v',include_path, 'mpolar.cpp', link_lib)
mex('-v',include_path, 'getColorSpace.cpp', link_lib)
mex('-v',include_path, 'getColorSpaceHist.cpp', link_lib)
Adhders commented 5 years ago

Thanks for your comment @soldatjiang . I have updated the files and tested the code with OpenCV 2.4 in Windows. I upload the mpolar.mexw64. Would you please try again and let me know whether it works with OpenCV 3?

it cant't run normally in Opencv 3.3.0

Adhders commented 5 years ago

Thanks for your comment @soldatjiang . I have updated the files and tested the code with OpenCV 2.4 in Windows. I upload the mpolar.mexw64. Would you please try again and let me know whether it works with OpenCV 3?

it cant't run normally in Opencv 3.3.0

Undefined function or variable 'mpolar'.

Error in logupdate (line 37) patchL = mpolar(double(patchL),p.mag);

Error in tracker (line 55) p = logupdate(1,im, pos, tmp_sc,tmp_rot,p);

Error in demo (line 22) [~,rects,~,~,~, time] = tracker(video_path, img_files, pos, target_sz, rot, show_visualization);

soldatjiang commented 5 years ago

@Adhders Recompile the mex files and try again

soldatjiang commented 5 years ago

@Adhders Have you solved this problem?

Adhders commented 5 years ago

@Adhders Have you solved this problem?

No! I have MEX files successfully ,but it can't run normally in windows;

The error message shows that:

Invalid MEX-file 'C:\Users\junbo\Desktop\LDES-master\utility\mexfiles\mpolar.mexw64': The specified module could not be found..

Error in logupdate (line 37) patchL = mpolar(double(patchL),p.mag);

Error in tracker (line 55) p = logupdate(1,im, pos, tmp_sc,tmp_rot,p);

Error in demo (line 22) [~,rects,~,~,~, time] = tracker(video_path, img_files, pos, target_sz, rot, show_visualization);

Adhders commented 5 years ago

@Adhders Recompile the mex files and try again

Have you solved this problem?
my configuration is Win10, Matlab2016b, VS2017 ,opencv2.4.11,

soldatjiang commented 5 years ago

@Adhders Have you recompiled the mex file? What problem did you meet? You can try to compile the mex files using my compiling script. Note that you should modify the path according to your configuration.

Adhders commented 5 years ago

image

Adhders commented 5 years ago

@Adhders Have you recompiled the mex file? What problem did you meet? You can try to compile the mex files using my compiling script. Note that you should modify the path according to your configuration. I have mex files successfully image

Adhders commented 5 years ago

@Adhders Have you recompiled the mex file? What problem did you meet? You can try to compile the mex files using my compiling script. Note that you should modify the path according to your configuration.

how and where to modify the path, I am new to Matlab. what does compile.m file used for?

ihpdep commented 5 years ago

@Adhders Have you solved this problem?

No! I have MEX files successfully ,but it can't run normally in windows;

The error message shows that:

Invalid MEX-file 'C:\Users\junbo\Desktop\LDES-master\utility\mexfiles\mpolar.mexw64': The specified module could not be found..

Error in logupdate (line 37) patchL = mpolar(double(patchL),p.mag);

Error in tracker (line 55) p = logupdate(1,im, pos, tmp_sc,tmp_rot,p);

Error in demo (line 22) [,rects,,,, time] = tracker(video_path, img_files, pos, target_sz, rot, show_visualization);

Hi, if you can compile the mpolar.cpp, it should be okay for running the code. It seems like you did not install your OpenCV correctly. Have you included the OpenCV path in your environment?

Adhders commented 5 years ago

@Adhders Have you solved this problem?

No! I have MEX files successfully ,but it can't run normally in windows; The error message shows that: Invalid MEX-file 'C:\Users\junbo\Desktop\LDES-master\utility\mexfiles\mpolar.mexw64': The specified module could not be found.. Error in logupdate (line 37) patchL = mpolar(double(patchL),p.mag); Error in tracker (line 55) p = logupdate(1,im, pos, tmp_sc,tmp_rot,p); Error in demo (line 22) [,rects,,,, time] = tracker(video_path, img_files, pos, target_sz, rot, show_visualization);

Hi, if you can compile the mpolar.cpp, it should be okay for running the code. It seems like you did not install your OpenCV correctly. Have you included the OpenCV path in your environment?

you are right!, I make it in windows with opencv 3.3.0, Thansk very much! image

ihpdep commented 5 years ago

I recompiled all mex files with OpenCV 3 and it works properly. Here is my compile script on my windows 7 x64 machine.

include_path = ['-I','D:\Program Files\opencv343\build\include'];
link_lib = fullfile('D:\Program Files\opencv343\build\x64\vc14\lib','opencv_world343.lib');
mex('-v',include_path,'mexResize.cpp','MxArray.cpp',link_lib)
mex('-v',include_path, 'mpolar.cpp', link_lib)
mex('-v',include_path, 'getColorSpace.cpp', link_lib)
mex('-v',include_path, 'getColorSpaceHist.cpp', link_lib)

Thanks for your script @soldatjiang

MSathishkumar1990 commented 4 years ago

I am getting this issue. Could you help me solve this, please?

mex mpolar.cpp Building with 'Microsoft Visual C++ 2017'. Error using mex mpolar.cpp G:\Documents\LDES-master - Copy\utility\mexfiles\mpolar.cpp(3): fatal error C1083: Cannot open include file: 'opencv2/opencv.hpp': No such file or directory

soldatjiang commented 4 years ago

@MSathishkumar1990

include_path = ['-I','D:\Program Files\opencv343\build\include'];
link_lib = fullfile('D:\Program Files\opencv343\build\x64\vc14\lib','opencv_world343.lib');
mex('-v',include_path,'mexResize.cpp','MxArray.cpp',link_lib)
mex('-v',include_path, 'mpolar.cpp', link_lib)
mex('-v',include_path, 'getColorSpace.cpp', link_lib)
mex('-v',include_path, 'getColorSpaceHist.cpp', link_lib)

You can complile mpolar with this script, modify include_path and link_path according to your configuration.