虚幻4调取摄像头
UE4引擎实使用OpenCV库实时调用电脑摄像头https://blog.csdn.net/d137578736/article/details/79037849(通过该网址实现)在编辑器模式下运行没有问题,但是打包后运行就出现了问题,请各位大神帮忙看一下,打包第三方库有什么需要注意的吗?ThirdParty 和Binary 必须放到插件里面,否则打包时dll 或者lib 不会拷贝
只有 Source 和Plugin 内的 dlllib才会拷贝。
修改build.cs 文件夹移动后需要重新编译工程 development 和development editor mknmknmk 发表于 2018-11-2 08:48
ThirdParty 和Binary 必须放到插件里面,否则打包时dll 或者lib 不会拷贝
只有 Source 和Plugin 内的 dll...
请问怎么修改build.cs呢? 我把ThirdParty 和 Binary 放到和OpenCv.build.cs 同一个目录 我使用的版本是4.19
修改 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(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");
}
PublicDefinitions.Add(string.Format("WITH_OPENCV_BINDING={0}", isLibrarySupported ? 1 : 0));
}
}
你的工程.Build.cs里 PublicDependencyModuleNames 添加 OpenCV 一行 ,编译一下
编译截图和文件夹截图
很棒 谢谢 感谢分享
页:
[1]