2015-12-22 28 views
13

你好,我想在android中创建动态用户脸部模型并向用户显示。如何在android中创建动态用户脸部模型?

我已经搜索并发现,我需要用户不同角度的脸部框架(图像)像14到16个图像,并且为了显示目的,需要在用户手指上使用opengl(用于平滑)更改图像(框架) 3D图像。
但我想喜欢一些编辑像(戴抽穗)在每一帧显示给用户像 https://lh3.googleusercontent.com/WLu3hm0nIhW5Ps9GeMS9PZiuc3n2B8xySKs1LfNTU1drOIqJ-iEvdiz-7Ww0ZX3ZtLk=h900

请给我一些建议或例子就可以了。

+0

我不明白你的问题......听起来像你想创建一个允许用户拍摄一堆照片的应用程序,然后以某种方式将它们全部以动画形式显示出来,并可以像耳环一样向图像添加一些内容...您希望如何他们能够添加东西?他们是否需要提供耳环的14至16张照片,或者您将预先加载这些照片?你在寻找什么样的例子?你想要一个已经完成你所描述的应用程序的例子吗? – pabrams

+0

如果您在我的问题中看到我共享的图像,那么您会发现她穿着耳朵的一个女孩图像(Earing是动态物体)并且脸部移动180度,以便我可以在3D模型中看到两个耳饰。 “ – Hits

回答

0

我希望你的照片适合记忆。
您可以将每个图像的ImageView添加到FrameLayout,并让一个ImageView可见。 然后,您甚至可以使用淡入/淡出动画来改善切换到下一张图像时的效果。

ImageView[] imageViews; 
int currentView = 0; 

... 

// fill imageViews 

... 

ImageView image1 = imageViews[currentView]; 

if (moveRight) { 
    if (++currentView >= imageViews.length) currentView = 0; 
} else { 
    if (--currentView < 0) currentView = imageViews.length - 1; 
} 

ImageView image2 = imageViews[currentView]; 

image1.setVisibility(View.INVISIBLE); 
image1.startAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_out)); 
image2.setVisibility(View.VISIBLE); 
image2.startAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_in)); 

动画/ fade_in.xml

<?xml version="1.0" encoding="utf-8"?> 
<set 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/linear_interpolator"> 
    <alpha 
     android:duration="150" 
     android:fromAlpha="0.0" 
     android:toAlpha="1.0"/> 
</set> 

动画/ fade_out.xml

<?xml version="1.0" encoding="utf-8"?> 
<set 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/linear_interpolator"> 
    <alpha 
     android:duration="150" 
     android:fromAlpha="1.0" 
     android:toAlpha="0.0"/> 
</set> 

关于硬件加速,我觉得在这种情况下的Android可以为您处理。 从Android 3.0的,你可以在清单应用程序或活动定义它:

android:hardwareAccelerated="true" 

或者你可以将它设置只为特定视图。

使用XML:

android:layerType="hardware" 

使用Java:

view.setLayerType(View.LAYER_TYPE_HARDWARE, null); 

在这里你可以找到更多有关Hardware Acceleration

+0

如果你的图像不适合内存,你将不得不在背景中加载它们,同时改变角度,这可能会导致一些滞后。所以也许最好是跳过一些图像或使用不同的方法(低质量的RGB565,较小的分辨率)。 –

相关问题