我想在Unity脚本中使用NDK模块的AugmentedImageDatabase函数来创建数据库并添加图像。
在使用externapi添加功能时,我不知道如何在Unity脚本端处理会话和数据库的参数。
[AndroidImport(ApiConstants.ARCoreNativeApi)]
public static extern ApiArStatus ArAugmentedImageDatabase_addImageWithPhysicalSize(IntPtr sessionHandle, IntPtr augmentedImageDatabaseHandle, string imageName, byte[] imageGrayscale, Int32 imageWidth, Int32 imageHeight, Int32 imageStride, float imageWidthinMeter, IntPtr outIndex);
[AndroidImport(ApiConstants.ARCoreNativeApi)]
public static extern void ArAugmentedImageDatabase_create (IntPtr sessionHandle, AugmentedImageDatabase result);
/* Create Database */
var nativeSession = LifecycleManager.Instance.NativeSession;
nativeSession.AugmentedImageDatabaseApi.CreateDatabase (nativeSession.SessionHandle, ??);
/* Add Images to Database */
nativeSession.AugmentedImageDatabaseApi.AddImage(nativeSession.SessionHandle, ??, "test.jpg", imageBuffer, image.Width, image.Height, image.YRowStride, 0.188f, outIndex);