Ask Your Question

About Using OpenCV in Unreal Engine 4 [closed]

asked 2020-11-20 14:35:47 -0500

StrongFish91 gravatar image

updated 2020-11-20 15:11:44 -0500

Hello everyone, I'm currently developing an application for the Microsoft's Hololens 2 at my work, and I need to recognize an image or pattern in order to be able to trigger an event.

What I want to know more about is the implementation of OpenCV in Unreal Engine 4, in order to test if OpenCV is our way to go with the application we are currently developng. I tried following a legacy documentation to add OpenCV 3 to UE4, but I had no luck with this. Any advices?

PD: Using Unity is not an option, my bosses insist in working with Unreal Engine 4. Thanks in advance for your answers.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2020-11-21 02:15:02.602212


LOL berak :)

sjhalayka gravatar imagesjhalayka ( 2020-11-21 11:33:32 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-11-20 17:31:04 -0500

sjhalayka gravatar image

updated 2020-11-20 18:53:46 -0500

There is no good reason to use OpenCV 3 over 4, if you're just starting out.

The easiest way to install OpenCV is to use the pre-built library at:

Run that file to extract the contents to your hard drive (for instance, C:\temp\opencv450).

Copy the include files: Go to C:\temp\opencv450\opencv\build\include -- copy the opencv2 folder to your Visual C++ folder (for instance, C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include)

Copy the lib files: Go to C:\temp\opencv450\opencv\build\x64\vc15\lib -- copy the lib files to your Visual C++ folder (for instance, C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\lib\x64)

Copy the DLL and exe files: Go to C:\temp\opencv450\opencv\build\x64\vc15\bin -- copy the dll and exe files to your C:\windows\system32 folder.

Once you have all of these files in place, you can add these to your code:

#include <opencv2/opencv.hpp>
using namespace cv;
#pragma comment(lib, "opencv_world450.lib")
edit flag offensive delete link more


those files don't belong in those directories. DO NOT mix files into unrelated directories. instead, the proper way to do it is configure the project/solution's include and library paths, and add to PATH the directory with dlls in them.

crackwitz gravatar imagecrackwitz ( 2020-11-21 14:19:50 -0500 )edit

Your method doesn't work for s**t when you're compiling on the command line. STFU or be constructive.

sjhalayka gravatar imagesjhalayka ( 2020-11-21 20:54:21 -0500 )edit

first, mind your tongue. your hostility is uncalled for and the polar opposite of constructive. your answer/advice requires mention of what's wrong with it and why. second, even "on the command line" you can pass additional include and library directories to the compiler and linker. since the question didn't mention command line usage, nothing more on that needs to be said.

crackwitz gravatar imagecrackwitz ( 2020-11-22 16:27:59 -0500 )edit

Question Tools

1 follower


Asked: 2020-11-20 14:35:47 -0500

Seen: 30 times

Last updated: Nov 20