Using UE5.0's OpenCV module to load the DNN pre-trained model, the program crashes
When I included OpenCV in the plugin, the engineering code compiled successfully, but when I ran it with the Actor I created and then loaded the pretrained model using cv::d nn::readNetFromCaffe, it crashed;the model is "res10_300x300_ssd_iter_140000_fp16.caffemodel",Prototex is "deploy.prototxt"。 run it on windows platform.
FString PluginConfigDir = FPaths::ProjectPluginsDir() + "HiKVision/Config/";
TSharedPtr<FJsonObject> Obj = GetJsonObjectFromFile(PluginConfigDir, FString("WaterCurtainDoor.json"));
day_confidence = (float)Obj->GetNumberField("dayConfidence");
night_confidence = (float)Obj->GetNumberField("nightConfidence");
AlphaValue = (float)Obj->GetNumberField("alphaValue");
BrightlessValue = (float)Obj->GetNumberField("BrightlessValue");
Yolo3Confidence = (float)Obj->GetNumberField("Yolo3Confidence");
OpenFace = Obj->GetBoolField("Openfacerecognition");
OpenBody = Obj->GetBoolField("OpenBodyrecognition");
bUseTCP = Obj->GetBoolField("UseTCP");
/**DNN Face Recognation*/
FString DnnModels = PluginConfigDir + TEXT("res10_300x300_ssd_iter_140000_fp16.caffemodel");
FString DNNBinary = PluginConfigDir + TEXT("deploy.prototxt");
std::string cstrModels =TCHAR_TO_UTF8(*DnnModels);
std::string cstrBinary = TCHAR_TO_UTF8(*DNNBinary);
net = cv::dnn::readNetFromCaffe(cstrBinary, cstrModels);
- Check the file path
- Recompile the OpenCV 4.5.5 library
- Use other advanced versions of the library 4.7.0
- I was OK to use OpenCV version 4.3.0, but it was in unreal engine version 4.27, not version 5.0
- Maybe there is something wrong with the new OpenCV call