我正在开发一款面向无人机摄像机视图的实时增强可视化的Android移动应用程序(特别是我正在使用相对SDK的DJI Phantom 3 Professional) . 我正在为AR部分使用Wikitude框架 . 每个Wikitude示例都通过增加智能手机的摄像头视图来工作,因此我需要重定向输入视频流 . 在这个阶段,通过使用DJI SDK功能,我有一个TextureView对象,其中包含来自无人机的正确解码的流 . 以下是当前视图的.xml文件顶部的相关说明:
<TextureView
android:id="@+id/video_previewer_surface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_centerHorizontal="true"
android:layout_above="@+id/linearLayout" />
实际上,Wikitude Architect View由相机流的渲染和渲染的渲染组成,如下图所示:Architect View Composition
sample_cam.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<com.wikitude.architect.ArchitectView
android:id="@+id/architectView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
有没有办法用我的 TextureView 的内容替换Wikitude Architect View的当前相机流?
或者,是否有办法将ArchitectView的相机流作为透明背景,以便将此层重叠到 TextureView ?
以下内容可能是.xml最终文件代码的一部分:
<TextureView
android:id="@+id/video_previewer_surface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_centerHorizontal="true"
android:layout_above="@+id/linearLayout" />
<com.wikitude.architect.ArchitectView // with transparent background for camera
android:id="@+id/architectView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
2 回答
亚历克斯答案是正确的,它的确有效以下是一些更多细节:Wikitude输入插件可用于提供您自己的相机输入,您也可以应用自己的扩充和自己的渲染 . 请参阅Wikitude输入插件文档 .
根据Wikitude示例,Custom Camera Plugin可以作为起点 . 您开发自己的Camera Extension,在构造函数中,您执行以下操作:
在这种情况下,我将WebRTC摄像机视图添加到Architect视图中 .
然后我实现了传入帧的回调 .
..将帧转换为nv21 Log.v(TAG,“make byte array”); byte [] b = getNV21(0,0,bmpRotate.getWidth(),bmpRotate.getHeight(),bmpRotate);
//并将框架传递给插件以进一步处理notifyNewCameraFrameN21(b);
希望这可以帮助 . 快乐的编码!菲尔
您可以将Wikitude Input Plugin与dji's Video Stream Decoding结合使用 . 因此,您从dji sdk获取原始视频数据并将其传递给wikitude sdk . 可以在样本名称为"Custom Camera"的wikitude示例应用程序中找到Input Plugin的示例代码 .