zk00006 / OpenTLD

OpenTLD is an open source library for real-time 2D tracking of a single object in video. This repository is no longer under development. For latest version see: http://www.tldvision.com/tld2.html
GNU General Public License v3.0
2.09k stars 1.27k forks source link

Errors when run compile.m #35

Open ghost opened 11 years ago

ghost commented 11 years ago

Hi,

I am installing the TLD application based on the instructions shown on https://github.com/zk00006/OpenTLD/wiki/Installation

Using:

OpenCV 2.4.2

Matlab R2010b x 64bits

Win7 x 64

VS2010 Professional

Everything works fine until I executed this step "6) In Matlab, run compile.m"

" PC Creating library C:\Users\Ko\AppData\Local\Temp\mex_VUBK1k\templib.x and object C:\Users\Ko\AppData\Local\Temp\mex_VUBK1k\templib.exp

lk.obj : error LNK2019: unresolved external symbol cvReleaseImage referenced in function "void __cdecl normCrossCorrelation(struct _IplImage ,struct _IplImage ,struct CvPoint2D32f ,struct CvPoint2D32f ,int,char ,float ,int,int)" (?normCrossCorrelation@@YAXPEAU_IplImage@@0PEAUCvPoint2D32f@@1HPEADPEAMHH@Z)

lk.obj : error LNK2019: unresolved external symbol cvMatchTemplate referenced in function "void __cdecl normCrossCorrelation(struct _IplImage ,struct _IplImage ,struct CvPoint2D32f ,struct CvPoint2D32f ,int,char ,float ,int,int)" (?normCrossCorrelation@@YAXPEAU_IplImage@@0PEAUCvPoint2D32f@@1HPEADPEAMHH@Z)

lk.obj : error LNK2019: unresolved external symbol cvGetRectSubPix referenced in function "void __cdecl normCrossCorrelation(struct _IplImage ,struct _IplImage ,struct CvPoint2D32f ,struct CvPoint2D32f ,int,char ,float ,int,int)" (?normCrossCorrelation@@YAXPEAU_IplImage@@0PEAUCvPoint2D32f@@1HPEADPEAMHH@Z)

lk.obj : error LNK2019: unresolved external symbol cvCreateImage referenced in function "void __cdecl normCrossCorrelation(struct _IplImage ,struct _IplImage ,struct CvPoint2D32f ,struct CvPoint2D32f ,int,char ,float ,int,int)" (?normCrossCorrelation@@YAXPEAU_IplImage@@0PEAUCvPoint2D32f@@1HPEADPEAMHH@Z)

lk.obj : error LNK2019: unresolved external symbol cvCalcOpticalFlowPyrLK referenced in function mexFunction

lk.obj : error LNK2019: unresolved external symbol cvAlloc referenced in function mexFunction

lk.mexw64 : fatal error LNK1120: 6 unresolved externals

C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Link of 'lk.mexw64' failed.

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

Error in ==> compile at 32 eval(['mex lk.cpp -O' include lib]);

"

I have searched through many websites but to no avail. Hopefully, someone can enlighten me on this problem. All solutions are greatly appreciated

Cheers, Ko

Ska-K commented 11 years ago

Same issue here, but with Win7 32b, MATLAB 2009b and VS2008. Did you find any solution? I'm trying to guess what happens.

Edit:

OK, got it. Actually it's a silly error. As you can see in compile.m, you need to have OpenCV headers and libs in the proper directories:

include = ' -Ic:\OpenCV2.2\include\opencv\ -Ic:\OpenCV2.2\include\';
libpath = 'c:\OpenCV2.2\lib\';

Do it manually if it's necessary, it will work. :)

davidhere40 commented 11 years ago

I had the same issue. You'll get the above errors if you are mixing 32 bit and 64 bit. Your openCV must have been compiled as 32bit. I got it to compile by changing the libpath to: libpath = 'C:\OpenCV-2.4.0\opencv\build\x64\vc10\lib\';

This is because my matlab is 64bit, but I compiled openCV as 32bit. So, I found some precompiled libraries and used those.

ghost commented 11 years ago

Thanks a lot for the solution provided. I managed to resolve the problem.

JLLL commented 11 years ago

Hi, i got this error, compile of 'lk.cpp' failed.

Cannot open include file: 'opencv2/core/core_c.h'

I tried to put "opencv\build\include\opencv2\core in the include string but still unable to solve it. Any help?

ygx2011 commented 11 years ago

opencv 2.4.3 win7 64bit vs2010b ??? Invalid MEX-file 'C:\Users\yinggaoxuan\Desktop\TLD\mex\lk.mexw64': C:\Users\yinggaoxuan\Desktop\TLD\mex\lk.mexw64 不是有效的 Win32 应用程序。

.

Error in ==> tldInit at 20 lk(0);

Error in ==> tldExample at 34 tld = tldInit(opt,[]);% train initial detector and initialize the 'tld' structure

Error in ==> run_TLD at 42 [bb,conf] = tldExample(opt);

I'll be very glad if someone can help me.

ygx2011 commented 11 years ago

Any help?

ygx2011 commented 11 years ago

opencv 2.4.3 win7 64bit vs2010b ??? Invalid MEX-file 'C:\Users\yinggaoxuan\Desktop\TLD\mex\lk.mexw64': C:\Users\yinggaoxuan\Desktop\TLD\mex\lk.mexw64 is not a valid Win32 application

.

Error in ==> tldInit at 20 lk(0);

Error in ==> tldExample at 34 tld = tldInit(opt,[]);% train initial detector and initialize the 'tld' structure

Error in ==> run_TLD at 42 [bb,conf] = tldExample(opt);

I'll be very glad if someone can help me.

the13thson commented 11 years ago

If I'm not mistaken - their software only runs on OpenCV 2.2 --- I may be wrong, but I'm also trying to get it work, and I read that last night.

ygx2011 commented 11 years ago

I have a classmate,his computer is 32bit,and his opencv is 2.4.3,it can runs on his computer,now,I have the same error with kolz.

niunuinui commented 10 years ago

i think u need OpenCV dll in x64 when you compile compile.m in a WIN7 x64 PC. So add OpenCV x64 dll instead of x86 dll to PATH, then "not a valid Win32 application" issue must be solved

freakbird commented 9 years ago

@kolz @davidhere40

I am also using OpenCV - 2.4.9 and Matlab 2013b both 64-bit. and getting the same issue. C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Link of 'lk.mexw64' failed.

Any directions on how to resolve it?

ygx2011 commented 9 years ago

i think the problem is the mix of c and matlab,you can run the C code on ubuntu,and i konw a way to run the matlab code on OS X,not windows.

freakbird commented 9 years ago

I was able to solve the issue, it was some syntax issue as I was using a recent version of Matlab. It's funny how all the forums online pointed me towards the 32-64 bit problem. Anyway I am posting the solution here so that in future it might help someone.

This was the modification I made in compile.m. Lines 25-30

files = dir(fullfile(libpath, '*.lib'));
lib = [];
for i = 1:length(files),
    lib = [lib ' ' libpath '\' files(i).name];
end

It was not reading the .lib files in the variable lib properly before and thus error in linking.

simonsayshi commented 6 years ago

@davidhere40 I believe I met the mixing issue too. however I failed to configure the 64bit when I use Cmake. I've searched a lot but none solved my problem. below is the error. Plus, do I have to install vs2010 if I'm going to compile 64bit with the vs2010 win64 option? it seems MS doesn't provide vs2010 anymore

capture

davidhere40 commented 6 years ago

I can't see the MSBuild error you're getting. It's cut off. I would recommend installing visual studio. I am doubtful you can compile it without it, but don't know for sure really.

Is visual studio 2010 not available here? https://www.visualstudio.com/vs/older-downloads/ You have to log in and I have an MSDN account. So, I'm not sure what it looks like without an account. I couldn't find VS 2015 community edition or "full" on there, but googled it and was able to find a link to it. If you can't find it on an official download page, you might find a link that way.

On Mon, Feb 19, 2018 at 8:37 PM, simonsayshi notifications@github.com wrote:

@davidhere40 https://github.com/davidhere40 I believe I met the mixing issue too. however I failed to configure the 64bit when I use Cmake. I've searched a lot but none solved my problem. below is the error. Plus, do I have to install vs2010 if I'm going to compile 64bit with the vs2010 win64 option? it seems MS doesn't provide vs2010 anymore

[image: capture] https://user-images.githubusercontent.com/31574218/36403042-625ad838-15b0-11e8-8477-660d62453213.PNG

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zk00006/OpenTLD/issues/35#issuecomment-366843034, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtxF1pvRhHGX5OShD-_Ug1BevZ4lgOTks5tWiHggaJpZM4AMvcZ .

simonsayshi commented 6 years ago

@davidhere40 thanks for reply! here attached the rest error message And I do have a MS account. the link you gave me is exactly what I searched for the older VS version but the vs2010 is not available to download. However there is Visual Studio 2010 VC++ Redistributable at the bottom and I installed it,but the issue remains:( this problem is driving me crazy:(

can you still run this compile.m on your PC?

image

davidhere40 commented 6 years ago

I see visual studio 2010 premium available in my msdn downloads. Do you not have that one?

I still can't see the error. I was looking at the part that says "error msb4019: The..." The ... is cut off.

I think precisely your problem is that it's trying to use a different compiler. Check out this thread: https://stackoverflow.com/questions/19718281/external-vs2013-build-error-error-msb4019-the-imported-project-path-was-not It mentions visual studio 2013. Maybe the tips in that link will help you specify the compiler without installing visual studio 2010. But if you can get 2010, might be more reliable. Also, you might want to delete your build folder and start over when you change the version you're using. Otherwise I've had problems in the past when the I changed versions but didn't clean out the build directory.

I'm currently in the middle of compiler pain myself. So I understand :) Someone needs to fix this crap. Why is it so hard to compile project dependencies like this. There has to be a better way.

On Mon, Feb 19, 2018 at 9:02 PM, simonsayshi notifications@github.com wrote:

@davidhere40 https://github.com/davidhere40 thanks for reply! here attached the rest error message And I do have a MS account. the link you gave me is exactly what I searched for the older VS version but the vs2010 is not available to download. However there is Visual Studio 2010 VC++ Redistributable at the bottom and I installed it,but the issue remains:( this problem is driving me crazy:(

[image: image] https://user-images.githubusercontent.com/31574218/36404152-20f2f1ee-15b7-11e8-9eac-65f4d1a7c633.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zk00006/OpenTLD/issues/35#issuecomment-366846379, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtxFwrE04LgdDCZ6PfgVqO-ijwFIRB3ks5tWieugaJpZM4AMvcZ .

simonsayshi commented 6 years ago

@davidhere40 now I successfully compiled the 64bit(yes I'm still dealing with it:( ) but when I run compile.m I met the issue: https://github.com/zk00006/OpenTLD/issues/52

every time I feel close to the result, I ran into errors :( any solution for this?

davidhere40 commented 6 years ago

Link doesn't work for me.

I finally solved my issue. I had to uninstall every other version of visual studio. Lol. What a pain.

So my general advice to fix your problem is this: -Check your path. Delete everything that doesn't belong. -Uninstall any other versions of any software that are not exactly the ones you need for compilation -dont try to use static libraries. I've had more success compiling dynamic libraries. -download an exact release version of every source code you need and follow someone's tutorial that specifies the versions of dependencies that work. -for every single dependency be very careful to use the exact same settings. Do not use 64bit! I often have trouble compiling 32bit versions of things. Use 32 bit, dynamic libraries (dll), debug mode (important!).

I just went through the exact same issues for three other software packages. It's a pain in the butt. The above is what I do and I was able to compile them all after a lot of trouble. For one of the software packages, I had to target 64bit to get it to work but I think for opencv, you will want to compile for 32bit.

On Feb 20, 2018 2:51 AM, "simonsayshi" notifications@github.com wrote:

@davidhere40 https://github.com/davidhere40 now I successfully compiled the 64bit(yes I'm still dealing with it:( ) but when I run compile.m I met the issue: https://github.com/zk00006/OpenTLD/issues/52 http://url

every time I feel close to the result, I ran into errors :( any solution for this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zk00006/OpenTLD/issues/35#issuecomment-366893486, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtxF2dyQRht8YSeeYdCJdOEWTyLRrkmks5tWnmegaJpZM4AMvcZ .

davidhere40 commented 6 years ago

I forgot to mention I even had to uninstall visual studio 64 bit and install 32 bit to get one of the software packages to compile for me! It wasn't opencv, but you might consider that too if it doesn't work.

On Tue, Feb 20, 2018, 9:01 AM David Jones davidhere40@gmail.com wrote:

Link doesn't work for me.

I finally solved my issue. I had to uninstall every other version of visual studio. Lol. What a pain.

So my general advice to fix your problem is this: -Check your path. Delete everything that doesn't belong. -Uninstall any other versions of any software that are not exactly the ones you need for compilation -dont try to use static libraries. I've had more success compiling dynamic libraries. -download an exact release version of every source code you need and follow someone's tutorial that specifies the versions of dependencies that work. -for every single dependency be very careful to use the exact same settings. Do not use 64bit! I often have trouble compiling 32bit versions of things. Use 32 bit, dynamic libraries (dll), debug mode (important!).

I just went through the exact same issues for three other software packages. It's a pain in the butt. The above is what I do and I was able to compile them all after a lot of trouble. For one of the software packages, I had to target 64bit to get it to work but I think for opencv, you will want to compile for 32bit.

On Feb 20, 2018 2:51 AM, "simonsayshi" notifications@github.com wrote:

@davidhere40 https://github.com/davidhere40 now I successfully compiled the 64bit(yes I'm still dealing with it:( ) but when I run compile.m I met the issue: https://github.com/zk00006/OpenTLD/issues/52 http://url

every time I feel close to the result, I ran into errors :( any solution for this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zk00006/OpenTLD/issues/35#issuecomment-366893486, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtxF2dyQRht8YSeeYdCJdOEWTyLRrkmks5tWnmegaJpZM4AMvcZ .

simonsayshi commented 6 years ago

@davidhere40 now I solved this problem..I just change matlab from 2017a to 2014b.......... now it can track the object I circled. but I still have question, since it mark objects in each frame, is that possible to save the frames having bounding box on the objects as a single image?

davidhere40 commented 6 years ago

I can't really help you with that. I haven't used matlab much at all and didn't really use OpenTLD. Probably can. I just don't know how or how hard it would be.

On Wed, Feb 21, 2018 at 1:03 AM, simonsayshi notifications@github.com wrote:

@davidhere40 https://github.com/davidhere40 now I solved this problem..I just change matlab from 2017a to 2014b.......... now it can track the object I circled. but I still have question, since it mark objects in each frame, is that possible to save the frames having bounding box on the objects as a single image?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zk00006/OpenTLD/issues/35#issuecomment-367223090, or mute the thread https://github.com/notifications/unsubscribe-auth/ACtxF-kwskN1qDlWdKJov9xtedCztLKxks5tW7G2gaJpZM4AMvcZ .