17

Hello I want to create the dynamic user face model in android and display to the user.

I have searched and found that I need user different angles face frames (Images) like 14 to 16 images and for displaying purpose need to change images (frame) using opengl (for smoothness) on user finger swipe so it look like 3D Image.
But I want like some editing like(wear earing) in each frame and display to the user as like https://lh3.googleusercontent.com/WLu3hm0nIhW5Ps9GeMS9PZiuc3n2B8xySKs1LfNTU1drOIqJ-iEvdiz-7Ww0ZX3ZtLk=h900

Please give me some suggestion or example on it.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Hitesh Bhalala
  • 2,872
  • 23
  • 40
  • 2
    I don't understand your question... sounds like you want to create an application that allows a user to take a bunch of pictures, then display them all in an animation somehow, with the option of adding something to the images like an earring... how do you want them to be able to add stuff? Do they need to provide 14 to 16 pictures of the earring, as well, or you will pre-load those? What kind of examples are you looking for? You want an example of an app that already does what you're describing? – pabrams Jan 06 '16 at 19:51
  • If you see the image that I have shared link in my question then you find that One girl image that she wear earing (Earing is dynamic object) and face move 180 degree so that I can see both ear ornaments as like in 3D model.' – Hitesh Bhalala Jan 06 '16 at 20:04

1 Answers1

1

I expect that your images fit in the memory.
You can add ImageView for every image to a FrameLayout and let just one ImageView be visible. Then you can even use fade in / fade out animation to improve the effect when switching to next image.

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));

anim/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>

anim/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>

About hardware acceleration, I think in this case Android can handle it for you. From Android 3.0 you can define it in the manifest for application or activity:

android:hardwareAccelerated="true"

Alternatively you can set it just for specific views.

Using XML:

android:layerType="hardware"

Using Java:

view.setLayerType(View.LAYER_TYPE_HARDWARE, null);

Here you can find more information about Hardware Acceleration

Milos Fec
  • 828
  • 6
  • 11
  • If your images doesn't fit in the memory you will have to load them at the background while changing an angle, that will probably cause some lags. So maybe better will be to skip some images or use different approach (lower quality RGB565, smaller resolution). – Milos Fec Jan 07 '16 at 00:38