How to Enable Torch/Flash with Tensorflow Posenet in Android

Hi Everyone,

I am new to tensoflow and android development.

I imported the tensorflow pose estimation model example from github and I am trying to add a “Flash/Torch” button to the model. Does anyone have any advice? or can point me in the right direction?

Any help will be appreciated, Apologies for asking a noob question.

Kind Regards

Hi @Stefan1,

The pose estimation model in the github does not have the said integrated feature. However you can integrate your "Flash/Torch " UI interface to the code. These are the steps :

  1. To use the camera and control the flashlight first add necessary permissions in your AndroidManifest.xml.
  <uses-permission android:name="android.permission.CAMERA />
   <uses-permission android:name="android.permission.FLASHLIGHT/>
  1. Add a button to your layout file for toggling the flashlight
      <Button
          android:id="@+id/flash_button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Flash" />
  1. Initialize the Camera Manager and the flash button. See the guide

  2. Last, Based on your project modify the code to make compatible between camera functionality and TF model.

Thank You