how to use a non uobject array in a uobject class without getting memory problems.
I am using an external library (opencv with contrib) and obviously it doesn't take in UObjects. My cpp contains the following in the tick function:
and the h file
Where detectMarkers writes to corners and ids, estimatePoseSingleMarkers writes to rvecs and tvecs and UPWMatrix being a Uobject class. This implementation, with std::vector s instead of TArrays for the tempMatrix and AllVisibleMarkers worked without a problem. Now as soon as I show a marker in front of the camera (where previously detectMarkers was returning corners and ids correctly) I get an "Access violation writing location" at the line of detectMarkers.
I suspect that it is to do with the UE4 garbage collection but I can't find anything online about how to stop them being destroyed without making the vectors into a different format that the opencv library can't handle. There may also be problems with the tempMatrix and AllVisibleMarkers but I have yet to hit a breakpoint inside the if statement so I have no idea yet. If I force in a single value for corners and ids it will still not get into the if statement but instead breaks at line 85 of MallocTBB.cpp
image, dictionary, detectorParamaters, cameraMatrix and distCoeffs are all set prior to this and as best I can tell are set correctly (I can't get the pdb files to step through them but the data that is visible all looks correct)
All help is gratefully appreciated, this is pretty much the last stumbling block on my project and it's driving me insane.
asked Mar 08 '17 at 06:49 PM in C++ Programming
Follow this question
Once you sign in you will be able to subscribe for any updates here