StephenGuanqi/Unity-ARKit-Plugin

CVbuffer access in Unity

lgRecip opened this issue · 11 comments

Hi,
Can I get the CVbuffer data directly inside Unity, like the IntPtr of the Yplane and CbCr?
It will be very usefull to feed another plugin with the YUV buffer for processing.
Your plugin can do that?
Thanks

Well currently it can't but I'm working on this feature.
Currently it only allows you to get the CVBuffer from the native objective-c interface in the native implementation objective-c++ file, but not from the C# interface in Unity.
I will finish this feature as soon as possible.

mmh, ok, nice!
It's a good work.
I was playing around the codes and i didn't archieve nothing, i can't figure how to push a mtlbuffer or the native cvbuffer directly in unity.
I will intempt to read your uiimage in unity, i think i have to push it in the app path.

i had try some things in this way (make a pointer to the cvbuffer in dll interface) but i always be in the same issue, casting the datas or bring them back to unity seem to me be impossible, i don't figure in wich format i have to make them to be pushed to unity.

Ok thanks,
If i find somthing i tell you.

Any update on this? I would like this feature as well, but am not familiar enough with Unity to do it myself.

I have just commit the previous missing files and you guys can try it for the new features.

Sorry about the inconvenience.

If we can't access the pixelbuffer directly from unity, could we directly access the file system where the json and images are stored?

How can we access it via unity? Would this work?

string savepath;      
 if (Application.platform == RuntimePlatform.IPhonePlayer) {
     savepath = Application.dataPath.Replace ("UnityARRecorder.app/Data", "/Documents/");
 }

I figured it out. I could access it with

Application.persistentDataPath: