ARCore:检测到图像后如何在相框中播放视频 [英] ARCore: How to play video in the photo frame when an image detected

查看:347
本文介绍了ARCore:检测到图像后如何在相框中播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在检测到图像时在相框中播放视频,有人使用ARCore这样做吗?会很有帮助的

I want to play video in in photo frame when image is detected, anybody who have done this using ARCore? would be great help

谢谢

推荐答案

我认为您的意思是要在检测到图像的情况下将视频作为可渲染的图像添加到ARCore中.

I think you mean you want to add a video as a renderable in ARCore, in your case when an image is detected.

(在撰写本文时)实际上存在一个包含在Sceneform中的示例,该示例显示了如何将视频添加为可渲染的视频-可在此处获得: https://github.com/google-ar/sceneform-android-sdk/tree/master/samples/chromakeyvideo

There is actually (at the time of writing) an example included with Sceneform showing how to add a video as a renderable - it is available here: https://github.com/google-ar/sceneform-android-sdk/tree/master/samples/chromakeyvideo

此示例还应用了色度滤镜,但是您可以忽略该部分.

This particular example also applies a Chroma filter but you can simply ignore that part.

方法大致为:

  • 创建一个外部纹理以播放视频
  • 创建一个MediaPlayer并将其表面设置为ExternalTexture的表面
  • 使用ExternalTexture构建新的可渲染对象
  • 创建一个节点并将其添加到场景中
  • 将节点的可渲染对象设置为您构建的新ModelRenderable

对于增强图像,只要图像状态为'TRACKING',ArCore就会自动计算其检测到的图像大小.

For Augmented images, ArCore will automatically calculate the size of the image that it detects so long as the state of the image is 'TRACKING". From the documentation:

ARCore将根据对世界的理解来尝试估计物理图像的宽度.如果在数据库中指定了可选的物理大小,则此估计过程将更快地进行.但是,估计的大小可能与指定的大小不同.

ARCore will attempt to estimate the physical image's width based on its understanding of the world. If the optional physical size is specified in the database, this estimation process will happen more quickly. However, the estimated size may be different from the specified size.

默认情况下,您的可渲染对象的大小将调整为适合该大小,但是您也可以根据需要放大或缩小缩放对象.

Your renderable will be sized to fit inside this by default but you can scale the renderable up or down as you want also.

根据您的实际需求,这里有一系列文章可能涵盖您的具体情况,并在此处提供了一些示例代码:

There is a series of articles available which may cover your exact case, depending on exactly what you need, along with some example code here: https://proandroiddev.com/arcore-sceneform-simple-video-playback-3fe2f909bfbc

这篇关于ARCore:检测到图像后如何在相框中播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆