How can I open the device camera with a pattern of body? To have the user take a picture into the pattern. The pattern shuold be an image.
Asked
Active
Viewed 61 times
1 Answers
1
I think you mean you want to have an outline that the user will fit their photo into - e.g. an outline of a body and the user then fits the person they are photoing into the body outline (hopefully, by moving the camera around rather than assaulting the person who is the subject of the photo!).
Assuming this is the case, then you can draw the outline on an image view which you overlay on top of the camera preview.
You can define this in your layout xml file - for example:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/camera_frag"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.acme.vision.AutoFitTextureView
android:id="@+id/texture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true" />
<LinearLayout
android:id="@+id/control"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:background="@color/colorPrimaryTransparent"
android:orientation="vertical">
<Button
android:id="@+id/picture_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/picture_button_text" />
</LinearLayout>
<RelativeLayout
android:id="@+id/tileview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/control"
android:background="@android:color/transparent" >
<ImageView
android:id="@+id/body_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/body_image_tablet"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout>

Mick
- 24,231
- 1
- 54
- 120