Ask Your Question
2

Building an executable which uses opencv that can be run on another computer

asked 2017-09-06 10:37:13 -0600

Colin Peeris gravatar image

I was wondering if it's possible to build an executable which uses opencv that can be used on another computer that does not have opencv or visual studios. I know this can be done for regular C++ code by going to the project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Libary and changing the setting to "Multi-threaded Debug (/MTd)" to remove the .dll file dependency . However, this doesn't work for projects that use OpenCV. Is there a solution for this?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2017-09-06 10:47:44 -0600

LBerger gravatar image

updated 2017-09-06 12:15:30 -0600

You can use only release mode. Disable cuda, lapack and avx optimisation too. Opencl shouldn't be a problem.

edit flag offensive delete link more

Comments

3

@LBerger i hope you don't mind when i convert your comment to an answer.

sturkmen gravatar imagesturkmen ( 2017-09-06 12:19:21 -0600 )edit
1

answered 2017-09-06 13:48:28 -0600

matman gravatar image

When you disable BUILD_SHARED_LIBS in CMake you get static libs in your OpenCV install directory. With these libs you can build your projects without the need of extra OpenCV.dll's.

I use this at work and it works as expected in Release and Debug mode. I can even build OpenCV with clFFT and clBlas (compiled as static libs) without the need of any extra dll. For OpenBlas I have to use MinGW compiler which is not compatible with VisualStudio for static lib. So for this I get some extra dll's. Perhabs MKL can be build in as static lib, but I don't have any experience with this.

edit flag offensive delete link more

Comments

Are you sure you can use debug on a computer without Visual Studio? You have to copy yourself all debug dll see https://social.msdn.microsoft.com/For... and https://stackoverflow.com/questions/2... I don't think it is possible to use static lib whithout opencv_ffmpeg.dll

LBerger gravatar imageLBerger ( 2017-09-06 14:10:09 -0600 )edit

I think I misunderstood this part. Debug runs on different machines, but it is possible that I need some extra dll's for this. I can check this tomorrow. Of course for ffmpeg you need a dll, but I don't use it. Also for OpenMP I need the vcomp.dll

matman gravatar imagematman ( 2017-09-06 15:00:48 -0600 )edit

Hi.

Thank you both for your replies. I'm not really sure how to use CMake. I opened the CMake Gui and entered "C:/OpenCV-3.1.0/opencv/sources" under the section that reads "where is the source code". I entered "C:/OpenCV-3.1.0/opencv_build" under the section that reads "where to build binaries". My OpenCV is originally in the directory "C:\OpenCV-3.1.0".

Before the configure, I uncheck the box on "BUILD_SHARED_LIBS". After generating however, I can't find any static libraries. Perhaps I'm doing it wrong. Are there any good and clear youtube tutorials that I can refer to? I've not really found a tutorial that I can follow easily.

I'm using Visual Studios 2015 and OpenCV version 3.1.0.

Thanks you so much for your help.

Colin Peeris gravatar imageColin Peeris ( 2017-09-06 19:04:48 -0600 )edit

try to install opencv like this

LBerger gravatar imageLBerger ( 2017-09-07 01:04:11 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-06 10:37:13 -0600

Seen: 3,153 times

Last updated: Sep 06 '17