问题
I'm trying to integrate CoreML model into my app. The output is given by a MLMultiArray, but I want the data in it in order to generate an OpenCV matrix. There is a dataPointer property in MLMultiArray, which is a UnsafeMutableRawPointer. How can I pass it as a C's pointer so that I can directly use it to generate an OpenCV matrix?
Thanks in advance!
回答1:
I found a solution. I don't need to pass the dataPointer as C's pointer from Swift to Objective-C++. I can just pass the whole MLMultiArray as long as I import in the obj-c++ file. And then I can directly use dataPointer to get a OpenCV Mat
来源:https://stackoverflow.com/questions/46762553/how-can-i-pass-unsafemutablerawpointer-as-a-cs-pointer-to-objective-c