AR(Vuforia)上的视频捕捉在Android平台上统一

AR(Vuforia)上的视频捕捉在Android平台上统一,第1张

概述我正在尝试为AR应用添加视频捕获功能. 基本上记录屏幕上发生的事情,并将其保存为视频(允许用户共享). AR APP使用Vuforia-Unity SDK编写. 我们在iOS平台上成功实现了这一点. 但是,在Android平台上做同样的事情我们遇到了很大的困难. (我们希望通过生根设备实现这一目标) 以下是我们的进展: > Vuforia程序使相机失灵,我无法访问视频流. >我尝试捕获每帧的scr 我正在尝试为AR应用添加视频捕获功能.
基本上记录屏幕上发生的事情,并将其保存为视频(允许用户共享).
AR APP使用Vuforia-Unity SDK编写.
我们在iOS平台上成功实现了这一点.

但是,在Android平台上做同样的事情我们遇到了很大的困难. (我们希望通过生根设备实现这一目标)

以下是我们的进展:

> Vuforia程序使相机失灵,我无法访问视频流.
>我尝试捕获每帧的screeshot,然后将它们组合成一些视频输出;但帧率很差(小于1 fps).拍摄屏幕截图需要700毫秒.

我是从错误的方向思考的吗?任何帮助将深表感谢!
非常感谢!
艾萨克

以下是我的测试代码:

public voID acquireScreenshot() {    displayMetrics metrics = new displayMetrics();    WindowManager WM = (WindowManager) MainActivity.this.getSystemService(Context.WINDOW_SERVICE);    display display = WM.getDefaultdisplay();    display.getMetrics(metrics);    int height = metrics.heightPixels; // screen height    int wIDth = metrics.wIDthPixels; // screen wIDth    int pixelformat = display.getPixelFormat();    PixelFormat localPixelFormat1 = new PixelFormat();    PixelFormat.getPixelFormatInfo(pixelformat,localPixelFormat1);    int deepth = localPixelFormat1.bytesPerPixel;    byte[] arrayOfByte = new byte[height* wIDth* deepth];    long tmp = System.currentTimeMillis();    try {        for(int i = 0 ; i < 10 ; i++){            inputStream localinputStream = readAsRoot();            DatainputStream localDatainputStream = new DatainputStream(                    localinputStream);            androID.util.Log.e("mytest","-----read start-------");            localDatainputStream.readFully(arrayOfByte);            androID.util.Log.e("mytest","-----read end-------time = "  + (System.currentTimeMillis() -tmp ));            localinputStream.close();            file mID = new file("/mnt/sdcard/AAA");            if(!mID.exists()){                mID.mkdir();            }            fileOutputStream out = new fileOutputStream(new file(                    "/mnt/sdcard/AAA/"+System.currentTimeMillis()+".png"));              int[] tmpcolor = new int[wIDth * height];            int r,g,b;            tmp = System.currentTimeMillis();            androID.util.Log.e("mytest","-----bitmap start-------");            for (int j = 0; j < wIDth * height * deepth; j+=deepth) {                b = arrayOfByte[j]&0xff;                g = arrayOfByte[j+1]&0xff;                r = arrayOfByte[j+2]&0xff;                tmpcolor[j/deepth] = (r << 16) | (g << 8) | b |(0xff000000);            }            Bitmap tmpMap = Bitmap.createBitmap(tmpcolor,wIDth,height,Bitmap.Config.ARGB_8888);            androID.util.Log.e("mytest","-----bitmap end-------time = "  + (System.currentTimeMillis() -tmp ));            tmp = System.currentTimeMillis();            androID.util.Log.e("mytest","-----compress start-------");            tmpMap.compress(Bitmap.CompressFormat.PNG,100,out);            androID.util.Log.e("mytest","-----compress end-------time = "  + (System.currentTimeMillis() -tmp ));            out.close();            Thread.sleep(40);        }    } catch (Exception e) {        androID.util.Log.e("mytest","Exception");        e.printstacktrace();    }}
解决方法 我们曾经使用一些英特尔插件来实现相机记录.

Video Capturing for Unity3d* Applications on Android*

实现起来非常简单.希望你会发现它们很有用.

总结

以上是内存溢出为你收集整理的AR(Vuforia)上的视频捕捉在Android平台上统一全部内容,希望文章能够帮你解决AR(Vuforia)上的视频捕捉在Android平台上统一所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1135468.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存