当前位置:网站首页>Ue5 opencv plug-in use
Ue5 opencv plug-in use
2022-07-03 08:15:00 【The east wind blows the Willows】
This plug-in is free ,UE5EA Personal test is valid , Thank you, senior friends , I won't thank you one by one here .
The plug-in for :OpenCVforUE5 plug-in unit - Internet document resources -CSDN download
1. The source code for
2. Project configuration
After decompressing Binaries、Plugins、ThirdParty The folder is directly copied to the root directory of the project
3. modify ProjectName.Build.cs
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.IO;
public class TestWebcam : ModuleRules
{
private string ThirdPartyPath
{
get{return Path.GetFullPath(Path.Combine(ModuleDirectory,"../../ThirdParty"));}
}
public TestWebcam(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","OpenCV"});
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
string OpenCVPath = Path.Combine(ThirdPartyPath, "OpenCV/");
PublicIncludePaths.AddRange(new string[] { Path.Combine(OpenCVPath, "Includes") });
PublicLibraryPaths.Add(Path.Combine(OpenCVPath, "Libraries/Win64"));
}
}
4. modify OpenCV.Build.cs
// Some copyright should be here...
using UnrealBuildTool;
using System.IO;
public class OpenCV : ModuleRules
{
private string ThirdPartyPath
{
get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../../../../ThirdParty/")); }
}
//public OpenCV(TargetInfo Target)
public OpenCV(ReadOnlyTargetRules Target) : base(Target)
{
// Startard Module Dependencies
PublicDependencyModuleNames.AddRange(new string[] { "Core", "RHI", "RenderCore" });
PrivateDependencyModuleNames.AddRange(new string[] { "CoreUObject", "Engine", "Slate", "SlateCore" });
// Start OpenCV linking here!
bool isLibrarySupported = false;
// Create OpenCV Path
string OpenCVPath = Path.Combine(ThirdPartyPath, "OpenCV");
// Get Library Path
string LibPath = "";
bool isdebug = Target.Configuration == UnrealTargetConfiguration.Debug && BuildConfiguration.bDebugBuildsActuallyUseDebugCRT;
if (Target.Platform == UnrealTargetPlatform.Win64)
{
LibPath = Path.Combine(OpenCVPath, "Libraries", "Win64");
isLibrarySupported = true;
}
else if (Target.Platform == UnrealTargetPlatform.Win32)
{
// TODO: add OpenCV binaries for Win32
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
// TODO: add OpenCV binaries for Mac
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
// TODO: add OpenCV binaries for Linux
}
else
{
string Err = string.Format("{0} dedicated server is made to depend on {1}. We want to avoid this, please correct module dependencies.", Target.Platform.ToString(), this.ToString()); System.Console.WriteLine(Err);
}
if (isLibrarySupported)
{
//Add Include path
PublicIncludePaths.AddRange(new string[] { Path.Combine(OpenCVPath, "Includes") });
// Add Library Path
PublicLibraryPaths.Add(LibPath);
//Add Static Libraries
PublicAdditionalLibraries.Add("opencv_world320.lib");
//Add Dynamic Libraries
PublicDelayLoadDLLs.Add("opencv_world320.dll");
PublicDelayLoadDLLs.Add("opencv_ffmpeg320_64.dll");
}
Definitions.Add(string.Format("WITH_OPENCV_BINDING={0}", isLibrarySupported ? 1 : 0));
}
}
5. modify OpenCV.cpp and OpenCV.h
//.cpp
//#include "OpenCVPrivatePCH.h"
#include "../Public/OpenCV.h"
//.h
//#include "ModuleManager.h"
#include "Modules/ModuleManager.h"
6. stay VS Project settings
Right click on the item -> attribute ->VC++ Catalog , stay Include Add a path to the directory :../../ThirdParty/OpenCV/Includes
7.UE5 Examples of use
stay UE5 Open plug-in in
establish webcam reader Blueprint class and material
take BP_WebCam Put it in level in , The operation effect is as follows :
Enjoy yourself , If there is a problem , Please reply in the comments section .
边栏推荐
猜你喜欢
STM32F103 SPI (pit Diary)
Free use until 2015 -- viz artist multi touch plug-in package
How to configure GDAL under idea
一个实习生的CnosDB之旅
Student educational administration management system of C # curriculum design
Getting started with minicom
Basic operation and process control
Un système de gestion de centre commercial pour la conception de cours de technologie d'application de base de données
I want to do large screen data visualization application feature analysis
Three characteristics
随机推荐
regular expression
【cocos creator】获取资源uuid
多旅行商问题——公式和求解过程概述
Get to know unity2 for the first time
Demonstration of plug-in use of ventuz basic series
oracle中的 (+)是什么意思
十六进制编码简介
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
My touch screen production "brief history" 2
Free use until 2015 -- viz artist multi touch plug-in package
MaxCompute字符串分割函数-SPLIT_PART
CLion-Toolchains are not configured Configure Disable profile问题解决
Go resolve ID card
E: Unable to locate package ROS melody desktop full
RM delete file
【K&R】中文第二版 个人题解 Chapter1
【云原生】微服务之Feign的介绍与使用
P1596 [USACO10OCT]Lake Counting S
oracle 插入单引号
[global product discovery 2] the first pure cloud augmented reality (AR) platform - Israel