how can I pass unsafemutablerawpointer as a C's pointer to objective c++?

北战南征 提交于 2019-12-14 04:04:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!