OpenCV in Unreal, Strange "Missing Module Exception"

I have a project where I am attempting to wrap some OpenCV objects and wrapping them such that you can utilize OpenCV functionality from within Unreal’s Blueprint system.

The project consists of 3 modules (later I will take the relevant modules and form a plugin for distribution). One is the project module that I test the set up, one is the OpenCV library reference module, and the last one is the OpenCV Blueprint wrapper. All dependencies are appropriately set. I made a test UObject C++ class in the OpenCV blueprint wrapper that simply instantiates a cv::Mat (myMatPtr = new cv::Mat():wink: on construction, and deletes it (FMemory::Free(myMatPtr):wink: upon destruction. I load up unreal and everything is fine. I instantiate it in an actor, and run it. presumably it is calling into the opencv .dll files creating a cv:Mat and destroying it properly, no errors! Great. I kick it into high gear and start implementing the most popular functionality, which is cv::VideoCapture. I implement it much in the same way I implemented the test object, but now when I try to load the project into the unreal editor I get a runtime exception mid load (~%70). Running it in debug mode reveals it it a “Missing Module Exception,” and is thrown just as it tries to instantiate the cv::VideoCapture object in the constructor of the UObject class wrapper. Both class’s CPP and H files are in the same place in the file hierarchy, so I’m not sure why there is a problem. If the first works, why not the new one? Relevant source is zipped up Here.

The AActor functions can be ignored, they are defined, but not implemented, however they are never called, as the classes are UObjects, and not AActors. They have been removed and the problem persists.

I had moved the initialization of the cv::VideoCapture pointer to another blueprintcallable function, and the project loaded, however if I called this initialization function on a given instance of VideoCapture using blueprint, I get an Accessed None error. Does this mean that cv::VideoCapture isn’t being compiled and included as I think it is?

Looking further into all of this… I fear that I’m doing this all completely wrong. The closest example I can find of what I’m doing is the incomplete Phya plugin, and I feel like how you’re supposed to wrap a third party library is this huge mystery to the community. It’s deplorable.

Implementing Unreal Actors in C++ that use OpenCV objects is possible, but trying to make Unreal Objects in C++ that mirror OpenCV objects seems difficult somehow… I’m probably just implementing UObject classes wrong.

The issue with the compilation was that I was not copying the dll files with my project’s binaries folder, once added everything compiled, Jury’s still out if this will work as I want it to however.