Build a tracker with open cv,clapack and visual studio 2015 [closed]

asked 2016-01-31 11:10:21 -0600

anony gravatar image

Hi I am trying to run the code of a visual object tracker that is written in c/c++ and is advised to configure using opencv 2.1 and lapack .however I am trying to run the code using visual studio 2015 ,open cv 3.0 or 3.1 inside visual studio with clapack. Below are the errors i am getting.

Error LNK2019 unresolved external symbol _dpotrf_ referenced in function _main tracker

Error LNK2019 unresolved external symbol _dgeqrf_ referenced in function _main tracker

Error LNK2019 unresolved external symbol _dorgqr_ referenced in function _main tracker


Now i think it is due to name mangling as the _ underscore before the function is shown ,but the thing is clapack.h file has the function declared using extern c . i have used all the necessary libraries and include folder to best of my knowledge.Any help would be greatly appreciated


Thank you

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-12-08 18:16:38.758238

Comments

I think that's not an opencv problem but a linker problem. You have to give path to lapack lib in visual studio as dpotrf seems to be a lapck function.

LBerger gravatar imageLBerger ( 2016-01-31 12:26:35 -0600 )edit

I know it is a clapack function . but didn't find answer any where so i asked here .just in case some one might have run into the similar problem and have found a solution

anony gravatar imageanony ( 2016-01-31 12:44:49 -0600 )edit

have you path to clapack lib to linker?

LBerger gravatar imageLBerger ( 2016-01-31 12:59:54 -0600 )edit

yes i have added blasd.lib lapackd.lib and libf2cd.lib in linker, additional library directories but still getting the same error

anony gravatar imageanony ( 2016-01-31 13:23:36 -0600 )edit

Is your source code available on github?

LBerger gravatar imageLBerger ( 2016-01-31 14:07:19 -0600 )edit

It is available on this site http://cv.snu.ac.kr/jhkwon/PAMI14_tra... .a geometric particle filter for template based visual tracking

anony gravatar imageanony ( 2016-01-31 21:01:05 -0600 )edit

grossly outdated code, unfortunately. i would not try too hard with that, but rather look for an alternative.

berak gravatar imageberak ( 2016-02-01 00:30:43 -0600 )edit

@berak thank you for looking at the code but it is not a solution .your comment only teaches that whenever there is a problem look for an easy way out . beside this i don't have any alternative option

anony gravatar imageanony ( 2016-02-01 03:08:42 -0600 )edit

@anony, it was just meant as a warning. since it is deprecated c-api all the way down, it will be hard to understand, maintain or fix.

berak gravatar imageberak ( 2016-02-01 03:27:49 -0600 )edit

Did you write an extern "C" declaration for the functions (from lapack) you used in your program, such as:

extern "C" void dpotrf_(char *uplo,int *jb,double *A,int *lda,int *info);
tuannhtn gravatar imagetuannhtn ( 2016-02-01 04:57:41 -0600 )edit

As tuannth said you have to replace in file clapack.h all

/* Subroutine */

by

/* Subroutine */ extern "C"

After don't forget to give path to lapack.lib libf2c.lib and blas.lib in your project

LBerger gravatar imageLBerger ( 2016-02-01 05:17:25 -0600 )edit

maybe you can get around the name-mangling like this:

extern "C" {    
  #include <f2c.h>
  #include <clapack.h>
};
berak gravatar imageberak ( 2016-02-01 05:29:43 -0600 )edit

@LBerger the libraries are already in the project path the only thing left is extern "c".i will recompile the clapack project and get back to you . @berak i had already tried this in my own code and was getting the same error .thanks @tuannhtn .

anony gravatar imageanony ( 2016-02-01 06:56:16 -0600 )edit

I have some experience with lapack when using it with OpenCV. In fact, you don't have to recompile the clapack project, just adding some external declarations of the functions you used in your program. In my case, I compiled lapack with GCC (using msys and mingw on Windows) and then used it with OpenCV in Visual Studio.

tuannhtn gravatar imagetuannhtn ( 2016-02-01 07:00:38 -0600 )edit