Showing preview only (2,124K chars total). Download the full file or copy to clipboard to get everything.
Repository: fritzlabs/fritz-examples
Branch: master
Commit: 3a74ba7fd269
Files: 701
Total size: 1.9 MB
Directory structure:
gitextract_je7ujmkl/
├── .gitattributes
├── .gitignore
├── .swiftlint.yml
├── Android/
│ ├── .gitignore
│ ├── AnimatedSkyApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── animatedSky/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── sky_fragment.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimen.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── BackgroundReplacementApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── replaceBackground/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── camera_connection_fragment_background_replace.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimen.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── CameraBoilerplateApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ ├── androidTest/
│ │ │ │ └── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── ai/
│ │ │ │ │ └── fritz/
│ │ │ │ │ └── camera/
│ │ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ │ ├── LiveCameraActivity.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── OverlayView.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ ├── ic_close.xml
│ │ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ │ └── round_button.xml
│ │ │ │ ├── drawable-v24/
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── layout/
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ │ └── camera_connection_fragment_stylize.xml
│ │ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ └── values/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── fritz.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test/
│ │ │ └── java/
│ │ │ └── ai/
│ │ │ └── fritz/
│ │ │ └── camera/
│ │ │ └── ExampleUnitTest.java
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── FritzAIStudio/
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── coco_labels_list.txt
│ │ │ │ └── imagenet_comp_graph_label_strings.txt
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── aistudio/
│ │ │ │ ├── Navigation.java
│ │ │ │ ├── PredictorType.java
│ │ │ │ ├── activities/
│ │ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ │ ├── BaseLiveVideoActivity.java
│ │ │ │ │ ├── BaseRecordingActivity.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ ├── SplashActivity.java
│ │ │ │ │ ├── custommodel/
│ │ │ │ │ │ ├── CustomTFLiteActivity.java
│ │ │ │ │ │ └── ml/
│ │ │ │ │ │ ├── Classifier.java
│ │ │ │ │ │ └── MnistClassifier.java
│ │ │ │ │ └── vision/
│ │ │ │ │ ├── ImageLabelingActivity.java
│ │ │ │ │ ├── ImageSegmentationActivity.java
│ │ │ │ │ ├── ObjectDetectionActivity.java
│ │ │ │ │ ├── PoseEstimationActivity.java
│ │ │ │ │ └── StyleTransferActivity.java
│ │ │ │ ├── adapters/
│ │ │ │ │ ├── DemoAdapter.java
│ │ │ │ │ └── DemoItem.java
│ │ │ │ ├── fragments/
│ │ │ │ │ └── CameraConnectionFragment.java
│ │ │ │ ├── ui/
│ │ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ │ ├── ChooseModelDialog.java
│ │ │ │ │ ├── DrawModel.java
│ │ │ │ │ ├── DrawRenderer.java
│ │ │ │ │ ├── DrawView.java
│ │ │ │ │ ├── OverlayView.java
│ │ │ │ │ ├── RecognitionScoreView.java
│ │ │ │ │ ├── ResultsView.java
│ │ │ │ │ └── SeparatorDecoration.java
│ │ │ │ └── utils/
│ │ │ │ └── VideoProcessingQueue.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── circle.xml
│ │ │ │ ├── circle_white.xml
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_heartbeat_logo.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── round_button.xml
│ │ │ │ └── splash_bg.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── font/
│ │ │ │ ├── sf_display.xml
│ │ │ │ ├── sf_ui_display_bold.otf
│ │ │ │ ├── sf_ui_display_light.otf
│ │ │ │ └── sf_ui_display_regular.otf
│ │ │ ├── layout/
│ │ │ │ ├── activity_camera.xml
│ │ │ │ ├── activity_fritz_vision.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_mnist.xml
│ │ │ │ ├── activity_tfmobile_camera.xml
│ │ │ │ ├── app_bar.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── camera_connection_fragment_recording.xml
│ │ │ │ ├── camera_connection_fragment_stylize.xml
│ │ │ │ ├── camera_connection_fragment_tracking.xml
│ │ │ │ ├── camera_connection_snapshot.xml
│ │ │ │ ├── list_item_demo.xml
│ │ │ │ └── list_text_item.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── custom_models.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── ic_launcher_background.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── FritzVisionVideoApp/
│ │ ├── .gitignore
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ ├── androidTest/
│ │ │ │ └── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── fritzvisionvideo/
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── ai/
│ │ │ │ │ └── fritz/
│ │ │ │ │ └── fritzvisionvideo/
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ ├── VideoActivity.java
│ │ │ │ │ ├── strategies/
│ │ │ │ │ │ ├── MaskCutStrategy.java
│ │ │ │ │ │ ├── ObjectPoseStrategy.java
│ │ │ │ │ │ ├── PoseDoubleMaskStrategy.java
│ │ │ │ │ │ ├── StylizeBackgroundStrategy.java
│ │ │ │ │ │ ├── StylizeHairStrategy.java
│ │ │ │ │ │ ├── VideoFilterStrategy.java
│ │ │ │ │ │ └── customfilters/
│ │ │ │ │ │ └── StylizeHairFilter.java
│ │ │ │ │ └── ui/
│ │ │ │ │ ├── DemoAdapter.java
│ │ │ │ │ ├── DemoItem.java
│ │ │ │ │ └── SeparatorDecoration.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ └── ic_launcher_background.xml
│ │ │ │ ├── drawable-v24/
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── font/
│ │ │ │ │ ├── sf_display.xml
│ │ │ │ │ ├── sf_ui_display_bold.otf
│ │ │ │ │ ├── sf_ui_display_light.otf
│ │ │ │ │ └── sf_ui_display_regular.otf
│ │ │ │ ├── layout/
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── activity_video.xml
│ │ │ │ │ ├── app_bar.xml
│ │ │ │ │ └── list_item_demo.xml
│ │ │ │ ├── menu/
│ │ │ │ │ └── video_menu.xml
│ │ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ └── values/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── fritz.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test/
│ │ │ └── java/
│ │ │ └── ai/
│ │ │ └── fritz/
│ │ │ └── fritzvisionvideo/
│ │ │ └── ExampleUnitTest.java
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── HairColoringApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ ├── androidTest/
│ │ │ │ └── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── haircoloring/
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── ai/
│ │ │ │ │ └── fritz/
│ │ │ │ │ └── haircoloring/
│ │ │ │ │ ├── activities/
│ │ │ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ │ │ ├── BaseLiveGPUActivity.java
│ │ │ │ │ │ ├── LiveHairColorActivity.java
│ │ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ │ └── VideoHairColorActivity.java
│ │ │ │ │ ├── ui/
│ │ │ │ │ │ ├── DemoAdapter.java
│ │ │ │ │ │ ├── DemoItem.java
│ │ │ │ │ │ └── SeparatorDecoration.java
│ │ │ │ │ └── views/
│ │ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ │ └── OverlayView.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ ├── ic_close.xml
│ │ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ │ └── round_button.xml
│ │ │ │ ├── drawable-v24/
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── font/
│ │ │ │ │ ├── sf_display.xml
│ │ │ │ │ ├── sf_ui_display_bold.otf
│ │ │ │ │ ├── sf_ui_display_light.otf
│ │ │ │ │ └── sf_ui_display_regular.otf
│ │ │ │ ├── layout/
│ │ │ │ │ ├── activity_camera.xml
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── activity_video.xml
│ │ │ │ │ ├── camera_color_slider.xml
│ │ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ │ └── list_item_demo.xml
│ │ │ │ ├── menu/
│ │ │ │ │ └── video_menu.xml
│ │ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ └── values/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── fritz.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test/
│ │ │ └── java/
│ │ │ └── ai/
│ │ │ └── fritz/
│ │ │ └── haircoloring/
│ │ │ └── ExampleUnitTest.java
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── ImageLabelingApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── image_labeling_quantized_model.tflite
│ │ │ │ └── label_recording_model.json
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── main_camera.xml
│ │ │ │ ├── snapshot_button.xml
│ │ │ │ └── snapshot_overlay_frame.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── ObjectDetectionApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── detect.tflite
│ │ │ │ └── object_recording_model.json
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── main_camera.xml
│ │ │ │ ├── snapshot_button.xml
│ │ │ │ └── snapshot_overlay_frame.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── PetMonitoringApp/
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── petdetector/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── ic_warning.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── camera_connection_fragment_stylize.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── PetStickerApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── petSticker/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── camera_connection_fragment_pet_sticker.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimen.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── PoseEstimationApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── PoseMobilenet353x25758Large1565627685.tflite
│ │ │ │ └── pose_recording_model.json
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── main_camera.xml
│ │ │ │ ├── snapshot_button.xml
│ │ │ │ └── snapshot_overlay_frame.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ └── README.md
├── LICENSE
├── README.md
├── SnapLensStudio/
│ └── README.md
└── iOS/
├── .gitignore
├── FritzAIStudio/
│ ├── FritzAIStudio/
│ │ ├── Media/
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ ├── SettingsIcon.imageset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── fritzLogo.imageset/
│ │ │ │ └── Contents.json
│ │ │ └── Base.lproj/
│ │ │ └── LaunchScreen.storyboard
│ │ ├── Source/
│ │ │ ├── Delegate/
│ │ │ │ └── AppDelegate.swift
│ │ │ ├── FritzCamera/
│ │ │ │ ├── FritzCamera/
│ │ │ │ │ ├── Delegates/
│ │ │ │ │ │ ├── CameraAVCaptureVideoDelegate.swift
│ │ │ │ │ │ └── CapturePhotoDelgate.swift
│ │ │ │ │ ├── Extensions/
│ │ │ │ │ │ ├── AVPhotoExtension.swift
│ │ │ │ │ │ ├── CameraResolutionExtension.swift
│ │ │ │ │ │ ├── CameraSessionExtensions.swift
│ │ │ │ │ │ ├── FritzCamera+CaptureDeviceExtensions.swift
│ │ │ │ │ │ ├── FritzCamera+Focus.swift
│ │ │ │ │ │ └── PhotoCaptureExtensions.swift
│ │ │ │ │ └── FritzCamera.swift
│ │ │ │ └── FritzCameraUI/
│ │ │ │ ├── CameraDelegateImplmentation.swift
│ │ │ │ ├── Extensions/
│ │ │ │ │ ├── ButtonFunctionality.swift
│ │ │ │ │ ├── CameraInterfaceHandler.swift
│ │ │ │ │ ├── DebugImageExtensions.swift
│ │ │ │ │ ├── FocusExtension.swift
│ │ │ │ │ └── GestureReconizerDelegateExtension.swift
│ │ │ │ ├── FritzCameraButton.swift
│ │ │ │ ├── FritzCameraControllerDelegate.swift
│ │ │ │ ├── FritzCameraViewController.swift
│ │ │ │ ├── FritzTextPromptView.swift
│ │ │ │ ├── Media.xcassets/
│ │ │ │ │ ├── Contents.json
│ │ │ │ │ ├── cameraFocus.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── cameraSwitch.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── cameraTorchAuto.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── cameraTorchOff.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── cameraTorchOn.imageset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Shaders/
│ │ │ │ ├── DepthToGrayscale.metal
│ │ │ │ ├── Mixer.metal
│ │ │ │ ├── PassThrough.metal
│ │ │ │ └── RosyEffect.metal
│ │ │ └── Modules/
│ │ │ ├── Common/
│ │ │ │ ├── AIStudioFeaturePredictors.swift
│ │ │ │ ├── AIStudioImagePredictor.swift
│ │ │ │ ├── FritzModelDetails.swift
│ │ │ │ ├── ImagePredictorProtocol.swift
│ │ │ │ ├── Logging/
│ │ │ │ │ ├── Locks.swift
│ │ │ │ │ ├── LogHandler.swift
│ │ │ │ │ └── Logging.swift
│ │ │ │ ├── ModelGroupManager.swift
│ │ │ │ ├── PredictorOptionTypes.swift
│ │ │ │ └── Utils/
│ │ │ │ ├── FritzDeviceUtil.swift
│ │ │ │ └── FritzLogger.swift
│ │ │ ├── Demos/
│ │ │ │ ├── Cells/
│ │ │ │ │ ├── DemoTableViewCell.swift
│ │ │ │ │ └── LinkTableViewCell.swift
│ │ │ │ ├── Demos.storyboard
│ │ │ │ ├── DemosViewController.swift
│ │ │ │ └── NavigationController.swift
│ │ │ ├── FeatureController/
│ │ │ │ ├── ChooseModelController.swift
│ │ │ │ ├── ConfigureModelCells/
│ │ │ │ │ ├── ChooseColorCell.swift
│ │ │ │ │ ├── ChooseColorCell.xib
│ │ │ │ │ ├── ChooseModelCell.swift
│ │ │ │ │ ├── ChooseModelCell.xib
│ │ │ │ │ ├── RangeSliderCell.swift
│ │ │ │ │ ├── RangeSliderCell.xib
│ │ │ │ │ ├── SegmentSliderCell.swift
│ │ │ │ │ └── SegmentSliderCell.xib
│ │ │ │ ├── ConfigurePopover.swift
│ │ │ │ ├── Extensions/
│ │ │ │ │ ├── NavigationBarCustomization.swift
│ │ │ │ │ └── SettingsButtonInteractionExtension.swift
│ │ │ │ ├── FeatureContainer.xib
│ │ │ │ ├── FeatureOptions.swift
│ │ │ │ ├── FeatureViewController.swift
│ │ │ │ ├── ModelOptions.storyboard
│ │ │ │ └── SettingsButton.swift
│ │ │ ├── ImageSegmentation/
│ │ │ │ └── ImageSegFeature.swift
│ │ │ ├── ModelExtensions/
│ │ │ │ ├── ImageSegmentationFeature.swift
│ │ │ │ └── PoseEstimation+ImagePredictor.swift
│ │ │ ├── PredictorControllers/
│ │ │ │ ├── DetectObjects/
│ │ │ │ │ ├── DetectObjectsStoryboard.storyboard
│ │ │ │ │ └── DetectObjectsViewController.swift
│ │ │ │ ├── HairColor+ColorSlider.swift
│ │ │ │ ├── HairColorViewController.swift
│ │ │ │ ├── ImageSegmentationViewController.swift
│ │ │ │ ├── LabelImages/
│ │ │ │ │ ├── FritzVisionLabelViewController.swift
│ │ │ │ │ └── LabelImages.storyboard
│ │ │ │ ├── PoseEstimationViewController.swift
│ │ │ │ └── StyleTransferViewController.swift
│ │ │ └── Root/
│ │ │ ├── Root.storyboard
│ │ │ └── RootViewController.swift
│ │ └── Supporting Files/
│ │ └── Info.plist
│ ├── FritzAIStudio.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzAIStudio.xcscheme
│ ├── LICENSE
│ ├── Podfile
│ ├── README.md
│ └── fastlane/
│ ├── Appfile
│ ├── Deliverfile
│ └── Fastfile
├── FritzARKitDemo/
│ ├── ARKIt+Utilities.swift
│ ├── FritzARKitDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── ObjectDetectionViewController.swift
│ │ ├── SCNVector+Extensions.swift
│ │ ├── Utils.swift
│ │ ├── ViewController.swift
│ │ └── art.scnassets/
│ │ ├── box.scn
│ │ └── ship.scn
│ ├── FritzARKitDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzARKitDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzHairColorDemo/
│ ├── FritzHairColorDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Controllers/
│ │ │ ├── HairPredictor.swift
│ │ │ ├── LiveHairViewController.swift
│ │ │ ├── NavigationController.swift
│ │ │ ├── VideoHairViewController.swift
│ │ │ └── ViewController.swift
│ │ ├── Info.plist
│ │ ├── Storyboards/
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── LiveHairColorStoryboard.storyboard
│ │ │ ├── Main.storyboard
│ │ │ └── VideoHairViewStoryboard.storyboard
│ │ └── UI/
│ │ ├── DemoTableViewCell.swift
│ │ ├── LinkTableViewCell.swift
│ │ └── VideoPicker.swift
│ ├── FritzHairColorDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzHandPoseEstimationDemo/
│ ├── FritzHandPoseEstimationDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── CameraButton.swift
│ │ ├── DraggableKeypoint.swift
│ │ ├── HandPose.mlmodel
│ │ ├── HandPoseModel.swift
│ │ ├── Info.plist
│ │ ├── UIImageView+Transformations.swift
│ │ └── ViewController.swift
│ ├── FritzHandPoseEstimationDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzHandPoseEstimationDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzImageLabelingDemo/
│ ├── FritzImageLabelingDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── SceneDelegate.swift
│ │ └── ViewController.swift
│ ├── FritzImageLabelingDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzImageLabelingDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzImageSegmentationDemo/
│ ├── FritzImageSegmentationDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── CustomBlurView.swift
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzImageSegmentationDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzMaskRecognitionDemo/
│ ├── FritzMaskRecognitionDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── MaskRecognition.mlmodel
│ │ ├── SceneDelegate.swift
│ │ └── ViewController.swift
│ ├── FritzMaskRecognitionDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzMaskRecognitionDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzObjectDetectionDemo/
│ ├── FritzObjectDetectionDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── SceneDelegate.swift
│ │ └── ViewController.swift
│ ├── FritzObjectDetectionDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzObjectDetectionDemo.xcscheme
│ └── Podfile
├── FritzPetStickerDemo/
│ ├── FritzPetStickerDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzPetStickerDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzPetStickerDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzPizzaDetectorDemo/
│ ├── Final/
│ │ ├── FritzPizzaDetectorDemo/
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ └── pizza.imageset/
│ │ │ │ └── Contents.json
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── ViewController.swift
│ │ ├── FritzPizzaDetectorDemo.xcodeproj/
│ │ │ └── project.pbxproj
│ │ └── Podfile
│ ├── README.md
│ └── Starter/
│ ├── FritzPizzaDetectorDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ ├── Contents.json
│ │ │ └── pizza.imageset/
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzPizzaDetectorDemo.xcodeproj/
│ │ └── project.pbxproj
│ └── Podfile
├── FritzPoseEstimationDemo/
│ ├── FritzPoseEstimationDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzPoseEstimationDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzSkyReplacementDemo/
│ ├── FritzSkyReplacementDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzSkyReplacementDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzStyleTransferDemo/
│ ├── FritzStyleTransferDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzStyleTransferDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzVisionVideoDemo/
│ ├── FritzVisionVideoDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ ├── Contents.json
│ │ │ └── ExportIcon.imageset/
│ │ │ └── Contents.json
│ │ ├── Controllers/
│ │ │ ├── NavigationController.swift
│ │ │ ├── SingleScreenViewController.swift
│ │ │ ├── SplitScreenViewController.swift
│ │ │ ├── Strategies/
│ │ │ │ ├── DoubleStyleStrategy.swift
│ │ │ │ ├── FemmesStrategy.swift
│ │ │ │ ├── ObjectPoseStrategy.swift
│ │ │ │ ├── PoseDoubleMaskStrategy.swift
│ │ │ │ ├── ScreamStrategy.swift
│ │ │ │ ├── StyleOptionStrategy.swift
│ │ │ │ ├── StylizeBackgroundStrategy.swift
│ │ │ │ ├── StylizeHairStrategy.swift
│ │ │ │ └── VideoOptionStrategy.swift
│ │ │ └── ViewController.swift
│ │ ├── Info.plist
│ │ ├── SceneDelegate.swift
│ │ ├── Storyboards/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ ├── Main.storyboard
│ │ │ ├── SingleScreenStoryboard.storyboard
│ │ │ └── SplitScreenStoryboard.storyboard
│ │ └── Utils/
│ │ └── StylizeHairMaskFilter.swift
│ ├── FritzVisionVideoDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
*.zip filter=lfs diff=lfs merge=lfs -text
================================================
FILE: .gitignore
================================================
#### CocoaPods
Pods/
*.generated.swift
#### Fastlane
fastlane/report.xml
fastlane/README.md
#### macOS
.DS_Store
#### Xcode
xcuserdata/
*.xcworkspace
iOS/*.zip
*.ipa
# For rswift build workaround
rswift.workaround.file
*.Framework/
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*
# Visual Studio cache directory
.vs/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.opendb
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
*.Framework/
*.framework.meta
.DS_Store
FritzConfig.asset
FritzConfig.asset.meta
# excluding local python version
.python-version
================================================
FILE: .swiftlint.yml
================================================
included:
- Heartbeat/Source
excluded:
- Pods
- Supporting Files
opt_in_rules:
- attributes
- closure_end_indentation
- empty_count
- explicit_top_level_acl
- force_unwrapping
disabled_rules:
- explicit_top_level_acl
- line_length
================================================
FILE: Android/.gitignore
================================================
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
gradle/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea
# Keystore files
*.jks
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# Google Services (e.g. APIs or Firebase)
google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
.DS_Store
================================================
FILE: Android/AnimatedSkyApp/.gitignore
================================================
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
*.iml
.idea
# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# Google Services (e.g. APIs or Firebase)
google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
================================================
FILE: Android/AnimatedSkyApp/README.md
================================================
# Animations with Sky Segmentation
[ ](https://app.codeship.com/projects/297281)
[](http://twitter.com/fritzlabs)
In this app, we create a simple photo app to replace the sky with an animation.

This example app uses the on-device Image Segmentation API with the Sky Segmentation Model for Android.
- [Overview](https://www.fritz.ai/features/image-segmentation.html?utm_source=github&utm_campaign=fritz-examples)
- [Documentation](https://docs.fritz.ai/develop/vision/image-segmentation/android.html?utm_source=github&utm_campaign=fritz-examples)
## Fritz AI
Fritz AI is the machine learning platform for iOS and Android developers. Teach your mobile apps to see, hear, sense, and think. Start with our ready-to-use feature APIs or connect and deploy your own custom models.
## Requirements
- Android Studio 3.2 or above
- Android device in developer model (USB debugging enabled)
## Getting Started
**Step 1: Choose a Fritz AI Plan**
[Sign up](https://www.fritz.ai/pricing/?utm_source=github&utm_campaign=fritz-examples) for a Fritz AI plan to get started.
Register the Android app in your Fritz account with the package id "ai.fritz.animatedSky". During registration, you'll receive an API key for the app. Save this for later. To find it in the webapp, you can go to Project Settings > Apps > Your App > Show API Key.
**Step 2: Clone / Fork the fritz-examples repository and open the AnimatedSkyApp app in Android Studio**
```
git clone https://github.com/fritzlabs/fritz-examples.git
```
In Android Studio, choose "Open an existing Android Studio project" and select `AnimatedSkyApp`.
**Step 3: Edit the fritz.xml file with your API Key**
In app/src/main/res/values/fritz.xml, change the fritz_api_key attribute with the one you received in step 1.
**Step 4: Build the Android Studio Project**
Select "Build > Make Project" from the top nav. Download any missing libraries if applicable. This should sync the gradle dependencies so give the build a second to complete.
**Step 5: Install the app onto your device**
With your Android device connected, select `Run > Run App` from the top nav. When running the app for the first time, you'll have to give permissions to access the camera. After the app is installed and running, take a picture outside and watch as we replace the sky with an animated image.
## Official Documentation
[SDK Documentation](https://docs.fritz.ai/?utm_source=github&utm_campaign=fritz-examples)
[Android API Docs](https://docs.fritz.ai/android/latest/index.html?utm_source=github&utm_campaign=fritz-examples)
## Join the community
[Heartbeat](https://heartbeat.fritz.ai/?utm_source=github&utm_campaign=fritz-examples) is a community of developers interested in the intersection of mobile and machine learning. [Chat with us in Slack](https://www.fritz.ai/slack?utm_source=github&utm_campaign=fritz-examples) and stay up to date on the latest mobile ML news with our [Newsletter](https://www.fritz.ai/newsletter?utm_source=github&utm_campaign=fritz-examples).
## Help
For any questions or issues, you can:
- Submit an issue on this repo
- Go to [Support](https://support.fritz.ai/?utm_source=github&utm_campaign=fritz-examples)
- Message us directly in [Slack](https://www.fritz.ai/slack?utm_source=github&utm_campaign=fritz-examples)
================================================
FILE: Android/AnimatedSkyApp/app/.gitignore
================================================
/build
================================================
FILE: Android/AnimatedSkyApp/app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
// MUST MATCH THE APPLICATION YOU CREATE IN FRITZ
applicationId "ai.fritz.animatedSky"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "ai.fritz:vision:6.0.3"
implementation "ai.fritz:vision-sky-segmentation-model-fast:3.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
================================================
FILE: Android/AnimatedSkyApp/app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: Android/AnimatedSkyApp/app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ai.fritz.animatedSky">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:largeHeap="true"
android:theme="@style/AppTheme">
<activity android:name="ai.fritz.animatedSky.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="ai.fritz.core.FritzCustomModelService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
</manifest>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/AutoFitTextureView.java
================================================
package ai.fritz.animatedSky;
import android.content.Context;
import android.util.AttributeSet;
import android.view.TextureView;
/**
* A {@link TextureView} that can be adjusted to a specified aspect ratio.
*/
public class AutoFitTextureView extends TextureView {
private int mRatioWidth = 0;
private int mRatioHeight = 0;
public AutoFitTextureView(Context context) {
this(context, null);
}
public AutoFitTextureView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AutoFitTextureView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
/**
* Sets the aspect ratio for this view. The size of the view will be measured based on the ratio
* calculated from the parameters. Note that the actual sizes of parameters don't matter, that
* is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result.
*
* @param width Relative horizontal size
* @param height Relative vertical size
*/
public void setAspectRatio(int width, int height) {
if (width < 0 || height < 0) {
throw new IllegalArgumentException("Size cannot be negative.");
}
mRatioWidth = width;
mRatioHeight = height;
requestLayout();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
if (0 == mRatioWidth || 0 == mRatioHeight) {
setMeasuredDimension(width, height);
return;
}
if (width < height * mRatioWidth / mRatioHeight) {
setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
return;
}
setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
}
}
================================================
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/BaseCameraActivity.java
================================================
package ai.fritz.animatedSky;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.ImageReader.OnImageAvailableListener;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Size;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.widget.Toast;
public abstract class BaseCameraActivity extends AppCompatActivity implements OnImageAvailableListener {
private static final String TAG = BaseCameraActivity.class.getSimpleName();
private static int MAX_WIDTH = 500;
private static final int PERMISSIONS_REQUEST = 1;
private static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;
private static final String PERMISSION_STORAGE = Manifest.permission.WRITE_EXTERNAL_STORAGE;
private boolean useCamera2API;
private boolean debug = false;
private Handler handler;
private HandlerThread handlerThread;
protected String cameraId;
protected int cameraFacingDirection = CameraCharacteristics.LENS_FACING_BACK;
@Override
protected void onCreate(final Bundle savedInstanceState) {
Log.d(TAG, "onCreate " + this);
super.onCreate(null);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
if (hasPermission()) {
setFragment();
} else {
requestPermission();
}
}
@Override
public synchronized void onStart() {
Log.d(TAG, "onStart " + this);
super.onStart();
}
@Override
public synchronized void onResume() {
Log.d(TAG, "onResume " + this);
super.onResume();
handlerThread = new HandlerThread("inference");
handlerThread.start();
handler = new Handler(handlerThread.getLooper());
}
@Override
public synchronized void onPause() {
Log.d(TAG, "onPause " + this);
handlerThread.quitSafely();
try {
handlerThread.join();
handlerThread = null;
handler = null;
} catch (final InterruptedException e) {
Log.e(TAG, "Exception!" + e);
}
super.onPause();
}
@Override
public synchronized void onStop() {
Log.d(TAG, "onStop " + this);
super.onStop();
}
@Override
public synchronized void onDestroy() {
Log.d(TAG, "onDestroy " + this);
super.onDestroy();
}
protected int getCameraFacingDirection() {
return cameraFacingDirection;
}
protected synchronized void runInBackground(final Runnable r) {
if (handler != null) {
handler.post(r);
}
}
@Override
public void onRequestPermissionsResult(
final int requestCode, final String[] permissions, final int[] grantResults) {
switch (requestCode) {
case PERMISSIONS_REQUEST: {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED
&& grantResults[1] == PackageManager.PERMISSION_GRANTED) {
setFragment();
} else {
requestPermission();
}
}
}
}
private boolean hasPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
boolean cameraPermission = checkSelfPermission(PERMISSION_CAMERA) == PackageManager.PERMISSION_GRANTED;
return cameraPermission;
} else {
return true;
}
}
private void requestPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (shouldShowRequestPermissionRationale(PERMISSION_CAMERA) || shouldShowRequestPermissionRationale(PERMISSION_STORAGE)) {
Toast.makeText(BaseCameraActivity.this, "Camera AND storage permission are required for this demo", Toast.LENGTH_LONG).show();
}
requestPermissions(new String[]{PERMISSION_CAMERA, PERMISSION_STORAGE}, PERMISSIONS_REQUEST);
}
}
protected void setFragment() {
cameraId = chooseCamera();
final CameraConnectionFragment fragment =
CameraConnectionFragment.newInstance(
new CameraConnectionFragment.ConnectionCallback() {
@Override
public void onPreviewSizeChosen(final Size previewSize, final Size cameraViewSize, final int rotation) {
BaseCameraActivity.this.onPreviewSizeChosen(previewSize, cameraViewSize, rotation);
}
},
this,
getLayoutId(),
getDesiredPreviewFrameSize());
fragment.setCamera(cameraId);
getFragmentManager()
.beginTransaction()
.replace(R.id.camera_container, fragment)
.commit();
}
protected void toggleCameraFacingDirection() {
if (cameraFacingDirection == CameraCharacteristics.LENS_FACING_FRONT) {
cameraFacingDirection = CameraCharacteristics.LENS_FACING_BACK;
} else {
cameraFacingDirection = CameraCharacteristics.LENS_FACING_FRONT;
}
setFragment();
}
private String chooseCamera() {
final CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
for (final String cameraId : manager.getCameraIdList()) {
final CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
// We don't use a front facing camera in this sample.
final Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
if (facing != null && facing != cameraFacingDirection) {
continue;
}
final StreamConfigurationMap map =
characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (map == null) {
continue;
}
// Fallback to camera1 API for internal cameras that don't have full support.
// This should help with legacy situations where using the camera2 API causes
// distorted or otherwise broken previews.
useCamera2API = (facing == CameraCharacteristics.LENS_FACING_EXTERNAL)
|| isHardwareLevelSupported(characteristics,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL);
Log.i(TAG, "Camera API lv2?: " + useCamera2API);
return cameraId;
}
} catch (CameraAccessException e) {
Log.e(TAG, "Not allowed to access camera: " + e);
}
return null;
}
// Returns true if the device supports the required hardware level, or better.
private boolean isHardwareLevelSupported(
CameraCharacteristics characteristics, int requiredLevel) {
int deviceLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
if (deviceLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
return requiredLevel == deviceLevel;
}
// deviceLevel is not LEGACY, can use numerical sort
return requiredLevel <= deviceLevel;
}
public boolean isDebug() {
return debug;
}
public void requestRender() {
final OverlayView overlay = (OverlayView) findViewById(R.id.debug_overlay);
if (overlay != null) {
overlay.postInvalidate();
}
}
public void setCallback(final OverlayView.DrawCallback callback) {
final OverlayView overlay = (OverlayView) findViewById(R.id.debug_overlay);
if (overlay != null) {
overlay.setCallback(callback);
}
}
public void onSetDebug(final boolean debug) {
}
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
debug = !debug;
requestRender();
onSetDebug(debug);
return true;
}
return super.onKeyDown(keyCode, event);
}
protected abstract void onPreviewSizeChosen(final Size previewSize, final Size cameraViewSize, final int rotation);
protected abstract int getLayoutId();
protected Size getDesiredPreviewFrameSize() {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float ratio = (float) metrics.heightPixels / metrics.widthPixels;
return new Size(MAX_WIDTH, (int) ratio * MAX_WIDTH);
}
}
================================================
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/CameraConnectionFragment.java
================================================
package ai.fritz.animatedSky;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.ImageFormat;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.ImageReader;
import android.media.ImageReader.OnImageAvailableListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.util.Log;
import android.util.Size;
import android.view.LayoutInflater;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
public class CameraConnectionFragment extends Fragment {
private static final String TAG = CameraConnectionFragment.class.getSimpleName();
public CameraConnectionFragment() {
}
/**
* The camera preview size will be chosen to be the smallest frame by pixel size capable of
* containing a DESIRED_SIZE x DESIRED_SIZE square.
*/
private static final int MINIMUM_PREVIEW_SIZE = 320;
/**
* Conversion from screen rotation to JPEG orientation.
*/
private static final String FRAGMENT_DIALOG = "dialog";
/**
* {@link android.view.TextureView.SurfaceTextureListener} handles several lifecycle events on a
* {@link TextureView}.
*/
private final TextureView.SurfaceTextureListener surfaceTextureListener =
new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(
final SurfaceTexture texture, final int width, final int height) {
openCamera(width, height);
}
@Override
public void onSurfaceTextureSizeChanged(
final SurfaceTexture texture, final int width, final int height) {
configureTransform(width, height);
}
@Override
public boolean onSurfaceTextureDestroyed(final SurfaceTexture texture) {
return true;
}
@Override
public void onSurfaceTextureUpdated(final SurfaceTexture texture) {
}
};
/**
* Callback for Activities to use to initialize their data once the
* selected preview size is known.
*/
public interface ConnectionCallback {
void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraRotation);
}
/**
* ID of the current {@link CameraDevice}.
*/
private String cameraId;
/**
* An {@link AutoFitTextureView} for camera preview.
*/
private AutoFitTextureView textureView;
/**
* A {@link CameraCaptureSession } for camera preview.
*/
private CameraCaptureSession captureSession;
/**
* A reference to the opened {@link CameraDevice}.
*/
private CameraDevice cameraDevice;
/**
* The rotation in degrees of the camera sensor from the display.
*/
private Integer sensorOrientation;
/**
* The {@link android.util.Size} of camera preview.
*/
private Size previewSize;
/**
* {@link android.hardware.camera2.CameraDevice.StateCallback}
* is called when {@link CameraDevice} changes its state.
*/
private final CameraDevice.StateCallback stateCallback =
new CameraDevice.StateCallback() {
@Override
public void onOpened(final CameraDevice cd) {
// This method is called when the camera is opened. We start camera preview here.
cameraOpenCloseLock.release();
cameraDevice = cd;
createCameraPreviewSession();
}
@Override
public void onDisconnected(final CameraDevice cd) {
cameraOpenCloseLock.release();
cd.close();
cameraDevice = null;
}
@Override
public void onError(final CameraDevice cd, final int error) {
cameraOpenCloseLock.release();
cd.close();
cameraDevice = null;
final Activity activity = getActivity();
if (null != activity) {
activity.finish();
}
}
};
/**
* An additional thread for running tasks that shouldn't block the UI.
*/
private HandlerThread backgroundThread;
/**
* A {@link Handler} for running tasks in the background.
*/
private Handler backgroundHandler;
/**
* An {@link ImageReader} that handles preview frame capture.
*/
private ImageReader previewReader;
/**
* {@link android.hardware.camera2.CaptureRequest.Builder} for the camera preview
*/
private CaptureRequest.Builder previewRequestBuilder;
/**
* {@link CaptureRequest} generated by {@link #previewRequestBuilder}
*/
private CaptureRequest previewRequest;
/**
* A {@link Semaphore} to prevent the app from exiting before closing the camera.
*/
private final Semaphore cameraOpenCloseLock = new Semaphore(1);
/**
* A {@link OnImageAvailableListener} to receive frames as they are available.
*/
private OnImageAvailableListener imageListener = null;
/**
* The input size in pixels desired by TensorFlow (width and height of a square bitmap).
*/
private Size inputSize = null;
/**
* The layout identifier to inflate for this Fragment.
*/
private int layout = -1;
private ConnectionCallback cameraConnectionCallback = null;
private CameraConnectionFragment(
final ConnectionCallback connectionCallback,
final OnImageAvailableListener imageListener,
final int layout,
final Size inputSize) {
this.cameraConnectionCallback = connectionCallback;
this.imageListener = imageListener;
this.layout = layout;
this.inputSize = inputSize;
}
/**
* Shows a {@link Toast} on the UI thread.
*
* @param text The message to show
*/
private void showToast(final String text) {
final Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(
new Runnable() {
@Override
public void run() {
Toast.makeText(activity, text, Toast.LENGTH_SHORT).show();
}
});
}
}
/**
* Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
* width and height are at least as large as the minimum of both, or an exact match if possible.
*
* @param choices The list of sizes that the camera supports for the intended output class
* @param width The minimum desired width
* @param height The minimum desired height
* @return The optimal {@code Size}, or an arbitrary one if none were big enough
*/
protected static Size chooseOptimalSize(final Size[] choices, final int width, final int height) {
final int minSize = Math.max(Math.min(width, height), MINIMUM_PREVIEW_SIZE);
final Size desiredSize = new Size(width, height);
// Collect the supported resolutions that are at least as big as the preview Surface
boolean exactSizeFound = false;
final List<Size> bigEnough = new ArrayList<Size>();
final List<Size> tooSmall = new ArrayList<Size>();
for (final Size option : choices) {
if (option.equals(desiredSize)) {
// Set the size but don't return yet so that remaining sizes will still be logged.
exactSizeFound = true;
}
if (option.getHeight() >= minSize && option.getWidth() >= minSize) {
bigEnough.add(option);
} else {
tooSmall.add(option);
}
}
Log.d(TAG, "Desired size: " + desiredSize + ", min size: " + minSize + "x" + minSize);
Log.d(TAG, "Valid preview sizes: [" + TextUtils.join(", ", bigEnough) + "]");
Log.d(TAG, "Rejected preview sizes: [" + TextUtils.join(", ", tooSmall) + "]");
if (exactSizeFound) {
Log.d(TAG, "Exact size match found.");
return desiredSize;
}
// Pick the smallest of those, assuming we found any
if (bigEnough.size() > 0) {
final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
Log.d(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
return chosenSize;
} else {
Log.e(TAG, "Couldn't find any suitable preview size");
return choices[0];
}
}
public static CameraConnectionFragment newInstance(
final ConnectionCallback callback,
final OnImageAvailableListener imageListener,
final int layout,
final Size inputSize) {
return new CameraConnectionFragment(callback, imageListener, layout, inputSize);
}
@Override
public View onCreateView(
final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(layout, container, false);
}
@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
textureView = (AutoFitTextureView) view.findViewById(R.id.texture);
}
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
startBackgroundThread();
// When the screen is turned off and turned back on, the SurfaceTexture is ai.fritz.heartbeat.ui.AutoFitTextureViewalready
// available, and "onSurfaceTextureAvailable" will not be called. In that case, we can open
// a camera and start preview from here (otherwise, we wait until the surface is ready in
// the SurfaceTextureListener).
if (textureView.isAvailable()) {
openCamera(textureView.getWidth(), textureView.getHeight());
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener);
}
}
@Override
public void onPause() {
closeCamera();
stopBackgroundThread();
super.onPause();
}
public void setCamera(String cameraId) {
this.cameraId = cameraId;
}
/**
* Sets up member variables related to camera.
*/
private void setUpCameraOutputs() {
final Activity activity = getActivity();
final CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
final CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
final StreamConfigurationMap map =
characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
// For still image captures, we use the largest available size.
final Size largest =
Collections.max(
Arrays.asList(map.getOutputSizes(ImageFormat.YUV_420_888)),
new CompareSizesByArea());
sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
// Danger, W.R.! Attempting to use too large a preview size could exceed the camera
// bus' bandwidth limitation, resulting in gorgeous previews but the storage of
// garbage capture data.
previewSize =
chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
inputSize.getWidth(),
inputSize.getHeight());
} catch (final CameraAccessException e) {
Log.e(TAG, "Exception!" + e);
} catch (final NullPointerException e) {
// Currently an NPE is thrown when the Camera2API is used but not supported on the
// device this code runs.
// TODO(andrewharp): abstract ErrorDialog/RuntimeException handling out into new method and
// reuse throughout app.
ErrorDialog.newInstance(getString(R.string.camera_error))
.show(getChildFragmentManager(), FRAGMENT_DIALOG);
throw new RuntimeException(getString(R.string.camera_error));
}
Size textureViewSize = new Size(textureView.getWidth(), textureView.getHeight());
cameraConnectionCallback.onPreviewSizeChosen(previewSize, textureViewSize, sensorOrientation);
}
/**
* Opens the camera specified by {@link CameraConnectionFragment#cameraId}.
*/
private void openCamera(final int width, final int height) {
setUpCameraOutputs();
configureTransform(width, height);
final Activity activity = getActivity();
final CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
if (!cameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("Time out waiting to lock camera opening.");
}
manager.openCamera(cameraId, stateCallback, backgroundHandler);
} catch (final CameraAccessException | SecurityException e) {
Log.e(TAG, "Exception!" + e);
} catch (final InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera opening.", e);
}
}
/**
* Closes the current {@link CameraDevice}.
*/
private void closeCamera() {
try {
cameraOpenCloseLock.acquire();
if (null != captureSession) {
captureSession.close();
captureSession = null;
}
if (null != cameraDevice) {
cameraDevice.close();
cameraDevice = null;
}
if (null != previewReader) {
previewReader.close();
previewReader = null;
}
} catch (final InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
} finally {
cameraOpenCloseLock.release();
}
}
/**
* Starts a background thread and its {@link Handler}.
*/
private void startBackgroundThread() {
backgroundThread = new HandlerThread("ImageListener");
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper());
}
/**
* Stops the background thread and its {@link Handler}.
*/
private void stopBackgroundThread() {
backgroundThread.quitSafely();
try {
backgroundThread.join();
backgroundThread = null;
backgroundHandler = null;
} catch (final InterruptedException e) {
Log.e(TAG, "Exception!" + e);
}
}
private final CameraCaptureSession.CaptureCallback captureCallback =
new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureProgressed(
final CameraCaptureSession session,
final CaptureRequest request,
final CaptureResult partialResult) {
}
@Override
public void onCaptureCompleted(
final CameraCaptureSession session,
final CaptureRequest request,
final TotalCaptureResult result) {
}
};
/**
* Creates a new {@link CameraCaptureSession} for camera preview.
*/
private void createCameraPreviewSession() {
try {
final SurfaceTexture texture = textureView.getSurfaceTexture();
assert texture != null;
// We configure the size of default buffer to be the size of camera preview we want.
texture.setDefaultBufferSize(previewSize.getWidth(), previewSize.getHeight());
// This is the output Surface we need to start preview.
final Surface surface = new Surface(texture);
// We set up a CaptureRequest.Builder with the output Surface.
previewRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
previewRequestBuilder.addTarget(surface);
Log.i(TAG, "Opening camera preview: " + previewSize.getWidth() + "x" + previewSize.getHeight());
// Create the reader for the preview frames.
previewReader =
ImageReader.newInstance(
previewSize.getWidth(), previewSize.getHeight(), ImageFormat.YUV_420_888, 2);
previewReader.setOnImageAvailableListener(imageListener, backgroundHandler);
previewRequestBuilder.addTarget(previewReader.getSurface());
// Here, we create a CameraCaptureSession for camera preview.
cameraDevice.createCaptureSession(
Arrays.asList(surface, previewReader.getSurface()),
new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(final CameraCaptureSession cameraCaptureSession) {
// The camera is already closed
if (null == cameraDevice) {
return;
}
// When the session is ready, we start displaying the preview.
captureSession = cameraCaptureSession;
try {
// Auto focus should be continuous for camera preview.
previewRequestBuilder.set(
CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
// Flash is automatically enabled when necessary.
previewRequestBuilder.set(
CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
// Finally, we start displaying the camera preview.
previewRequest = previewRequestBuilder.build();
captureSession.setRepeatingRequest(
previewRequest, captureCallback, backgroundHandler);
} catch (final CameraAccessException e) {
Log.e(TAG, "Exception!" + e);
}
}
@Override
public void onConfigureFailed(final CameraCaptureSession cameraCaptureSession) {
showToast("Failed");
}
},
null);
} catch (final CameraAccessException e) {
Log.e(TAG, "Exception!" + e);
}
}
/**
* Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`.
* This method should be called after the camera preview size is determined in
* setUpCameraOutputs and also the size of `mTextureView` is fixed.
*
* @param viewWidth The width of `mTextureView`
* @param viewHeight The height of `mTextureView`
*/
private void configureTransform(final int viewWidth, final int viewHeight) {
final Activity activity = getActivity();
if (null == textureView || null == previewSize || null == activity) {
return;
}
final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
final Matrix matrix = new Matrix();
final RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
final RectF bufferRect = new RectF(0, 0, previewSize.getHeight(), previewSize.getWidth());
final float centerX = viewRect.centerX();
final float centerY = viewRect.centerY();
if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
final float scale =
Math.max(
(float) viewHeight / previewSize.getHeight(),
(float) viewWidth / previewSize.getWidth());
matrix.postScale(scale, scale, centerX, centerY);
matrix.postRotate(90 * (rotation - 2), centerX, centerY);
} else if (Surface.ROTATION_180 == rotation) {
matrix.postRotate(180, centerX, centerY);
}
textureView.setTransform(matrix);
}
/**
* Compares two {@code Size}s based on their areas.
*/
static class CompareSizesByArea implements Comparator<Size> {
@Override
public int compare(final Size lhs, final Size rhs) {
// We cast here to ensure the multiplications won't overflow
return Long.signum(
(long) lhs.getWidth() * lhs.getHeight() - (long) rhs.getWidth() * rhs.getHeight());
}
}
/**
* Shows an error message dialog.
*/
public static class ErrorDialog extends DialogFragment {
private static final String ARG_MESSAGE = "message";
public static ErrorDialog newInstance(final String message) {
final ErrorDialog dialog = new ErrorDialog();
final Bundle args = new Bundle();
args.putString(ARG_MESSAGE, message);
dialog.setArguments(args);
return dialog;
}
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Activity activity = getActivity();
return new AlertDialog.Builder(activity)
.setMessage(getArguments().getString(ARG_MESSAGE))
.setPositiveButton(
android.R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialogInterface, final int i) {
activity.finish();
}
})
.create();
}
}
}
================================================
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/MainActivity.java
================================================
package ai.fritz.animatedSky;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.media.Image;
import android.media.ImageReader;
import android.os.Bundle;
import android.util.Size;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicBoolean;
import ai.fritz.core.Fritz;
import ai.fritz.vision.FritzVision;
import ai.fritz.vision.FritzVisionImage;
import ai.fritz.vision.FritzVisionModels;
import ai.fritz.vision.FritzVisionOrientation;
import ai.fritz.vision.ImageOrientation;
import ai.fritz.vision.ImageRotation;
import ai.fritz.vision.ModelVariant;
import ai.fritz.vision.imagesegmentation.FritzVisionSegmentationPredictor;
import ai.fritz.vision.imagesegmentation.FritzVisionSegmentationPredictorOptions;
import ai.fritz.vision.imagesegmentation.FritzVisionSegmentationResult;
import ai.fritz.vision.imagesegmentation.MaskClass;
import ai.fritz.vision.imagesegmentation.SegmentationOnDeviceModel;
public class MainActivity extends BaseCameraActivity implements ImageReader.OnImageAvailableListener {
private static final String TAG = MainActivity.class.getSimpleName();
private AtomicBoolean shouldSample = new AtomicBoolean(true);
private FritzVisionSegmentationPredictor predictor;
private ImageOrientation orientation;
private static final int DURATION = 5000;
private ValueAnimator mCurrentAnimator;
private Matrix mMatrix = new Matrix();
private ImageView mImageView;
private float mScaleFactor;
private RectF mDisplayRect = new RectF();
private FritzVisionSegmentationResult segmentResult;
private FritzVisionImage visionImage;
Button snapshotButton;
RelativeLayout previewLayout;
RelativeLayout snapshotLayout;
OverlayView snapshotOverlay;
ProgressBar snapshotProcessingSpinner;
Button closeButton;
FritzVisionSegmentationPredictorOptions options;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fritz.configure(getApplicationContext());
SegmentationOnDeviceModel onDeviceModel = FritzVisionModels.getSkySegmentationOnDeviceModel(ModelVariant.FAST);
options = new FritzVisionSegmentationPredictorOptions();
options.confidenceThreshold = .6f;
predictor = FritzVision.ImageSegmentation.getPredictor(onDeviceModel, options);
}
@Override
protected int getLayoutId() {
return R.layout.sky_fragment;
}
@Override
public void onPreviewSizeChosen(final Size size, final Size cameraSize, final int rotation) {
orientation = FritzVisionOrientation.getImageOrientationFromCamera(this, cameraId);
snapshotButton = findViewById(R.id.take_picture_btn);
previewLayout = findViewById(R.id.preview_frame);
snapshotLayout = findViewById(R.id.snapshot_frame);
snapshotOverlay = findViewById(R.id.snapshot_view);
closeButton = findViewById(R.id.close_btn);
snapshotProcessingSpinner = findViewById(R.id.snapshotProcessingSpinner);
mImageView = findViewById(R.id.backgroundImgView);
snapshotOverlay.setCallback(new OverlayView.DrawCallback() {
@Override
public void drawCallback(final Canvas canvas) {
// If there's no result, just return
if (segmentResult == null) {
return;
}
// Create a bitmap for undetected items. Scale it up for the camera.
Bitmap notSkyMask = segmentResult.buildSingleClassMask(MaskClass.NONE);
Bitmap notSkyBitmap = visionImage.mask(notSkyMask);
// Scale the non-sky bitmap (scale up from preview size (size of the original image)
// to fill the view (cameraSize)).
float scaleWidth = ((float) cameraSize.getWidth()) / notSkyBitmap.getWidth();
float scaleHeight = ((float) cameraSize.getHeight()) / notSkyBitmap.getHeight();
final Matrix matrix = new Matrix();
float scale = Math.min(scaleWidth, scaleHeight);
matrix.postScale(scale, scale);
Bitmap scaledNonSkyBitmap = Bitmap.createBitmap(notSkyBitmap, 0, 0, notSkyBitmap.getWidth(), notSkyBitmap.getHeight(), matrix, false);
// Start the animation
mImageView.post(new Runnable() {
@Override
public void run() {
mScaleFactor = (float) mImageView.getHeight() / (float) mImageView.getDrawable().getIntrinsicHeight();
mMatrix.postScale(mScaleFactor, mScaleFactor);
mImageView.setImageMatrix(mMatrix);
startAnimation();
}
});
// Draw the non-sky bitmap on the bottom center.
canvas.drawBitmap(scaledNonSkyBitmap, (cameraSize.getWidth() - scaledNonSkyBitmap.getWidth()) / 2, cameraSize.getHeight() - scaledNonSkyBitmap.getHeight(), new Paint());
}
});
snapshotButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!shouldSample.compareAndSet(true, false)) {
return;
}
snapshotOverlay.postInvalidate();
runInBackground(
new Runnable() {
@Override
public void run() {
showSpinner();
segmentResult = predictor.predict(visionImage);
showSnapshotLayout();
hideSpinner();
snapshotOverlay.postInvalidate();
}
});
}
});
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showPreviewLayout();
shouldSample.set(true);
mCurrentAnimator.end();
mMatrix = new Matrix();
mImageView.setImageMatrix(mMatrix);
mDisplayRect = new RectF();
}
});
}
// For more information on how this animation works:
// http://old.flavienlaurent.com/blog/2013/08/05/make-your-background-moving-like-on-play-music-app/
// In short, use displayRect to maintain the real size and position of the bg.
// Animate the background by applying a translation.
private void startAnimation() {
int width = mImageView.getDrawable().getIntrinsicWidth();
int height = mImageView.getDrawable().getIntrinsicHeight();
mDisplayRect.set(0, 0, width, height);
mMatrix.mapRect(mDisplayRect);
animate(mDisplayRect.left, mDisplayRect.left - (mDisplayRect.right - mImageView.getWidth()));
}
private void animate(float from, float to) {
mCurrentAnimator = ValueAnimator.ofFloat(from, to);
mCurrentAnimator.setRepeatCount(ValueAnimator.INFINITE);
mCurrentAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (Float) animation.getAnimatedValue();
mMatrix.reset();
mMatrix.postScale(mScaleFactor, mScaleFactor);
mMatrix.postTranslate(value, 0);
mImageView.setImageMatrix(mMatrix);
}
});
mCurrentAnimator.setDuration(DURATION);
mCurrentAnimator.start();
}
private void showSpinner() {
runOnUiThread(new Runnable() {
@Override
public void run() {
snapshotProcessingSpinner.setVisibility(View.VISIBLE);
}
});
}
private void hideSpinner() {
runOnUiThread(new Runnable() {
@Override
public void run() {
snapshotProcessingSpinner.setVisibility(View.GONE);
}
});
}
private void showSnapshotLayout() {
runOnUiThread(new Runnable() {
@Override
public void run() {
previewLayout.setVisibility(View.GONE);
snapshotLayout.setVisibility(View.VISIBLE);
}
});
}
private void showPreviewLayout() {
previewLayout.setVisibility(View.VISIBLE);
snapshotLayout.setVisibility(View.GONE);
}
@Override
public void onImageAvailable(final ImageReader reader) {
Image image = reader.acquireLatestImage();
if (image == null) {
return;
}
if (!shouldSample.get()) {
image.close();
return;
}
// Feel free to uncomment if you'd like to try it out with a static image
// Bitmap testImage = getBitmapForAsset(this, "climbing.png");
// visionImage = FritzVisionImage.fromBitmap(testImage, ImageRotation.ROTATE_0);
// Using the image from the camera
visionImage = FritzVisionImage.fromMediaImage(image, orientation);
image.close();
}
public static Bitmap getBitmapForAsset(Context context, String path) {
AssetManager assetManager = context.getAssets();
InputStream inputStream;
Bitmap bitmap = null;
try {
inputStream = assetManager.open(path);
bitmap = BitmapFactory.decodeStream(inputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
return bitmap;
}
}
================================================
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/OverlayView.java
================================================
package ai.fritz.animatedSky;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
/**
* A simple View providing a render callback to other classes.
*/
public class OverlayView extends View {
private DrawCallback callback;
public OverlayView(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
/**
* Interface defining the callback for client classes.
*/
public interface DrawCallback {
public void drawCallback(final Canvas canvas);
}
public void setCallback(final DrawCallback callback) {
this.callback = callback;
}
@Override
public synchronized void draw(final Canvas canvas) {
super.draw(canvas);
if(callback != null) {
callback.drawCallback(canvas);
}
}
}
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/drawable/ic_close.xml
================================================
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFF"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/drawable/ic_launcher_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/drawable/round_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:color="#FFFF"
android:width="5dip"/>
<size android:width="100dp" android:height="100dp"/>
</shape>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
================================================
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/layout/activity_main.xml
================================================
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/camera_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.constraint.ConstraintLayout>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/layout/sky_fragment.xml
================================================
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/preview_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ai.fritz.animatedSky.AutoFitTextureView
android:id="@+id/texture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<ai.fritz.animatedSky.OverlayView
android:id="@+id/debug_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/margin_sm"
android:layout_marginBottom="@dimen/margin_lg">
<Button
android:id="@+id/take_picture_btn"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:background="@drawable/round_button"
android:textColor="#fff" />
<ProgressBar
android:id="@+id/snapshotProcessingSpinner"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminateTint="#fff"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/snapshot_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/backgroundImgView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="matrix"
android:src="@drawable/skybgreplacement"/>
<ai.fritz.animatedSky.OverlayView
android:id="@+id/snapshot_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<Button
android:id="@+id/close_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/margin_sm"
android:layout_marginRight="@dimen/margin_sm"
android:background="@drawable/ic_close" />
</RelativeLayout>
</RelativeLayout>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/values/dimen.xml
================================================
<!--
Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
<dimen name="margin_xs">4dp</dimen>
<dimen name="margin_sm">8dp</dimen>
<dimen name="margin_md">16dp</dimen>
<dimen name="margin_lg">32dp</dimen>
<dimen name="margin_xl">64dp</dimen>
<!-- Semantic definitions -->
<dimen name="horizontal_page_margin">@dimen/margin_md</dimen>
<dimen name="vertical_page_margin">@dimen/margin_md</dimen>
</resources>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/values/fritz.xml
================================================
<resources>
<string name="fritz_api_key">Your API Key</string>
</resources>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">Sky Animation</string>
<string name="camera_error">This device doesn\'t support Camera2 API.</string>
</resources>
================================================
FILE: Android/AnimatedSkyApp/app/src/main/res/values/styles.xml
================================================
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
================================================
FILE: Android/AnimatedSkyApp/build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// ADD FOR FRITZ DEPENDENCIES
maven { url "https://fritz.mycloudrepo.io/public/repositories/android" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: Android/AnimatedSkyApp/gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
================================================
FILE: Android/AnimatedSkyApp/gradlew
================================================
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
================================================
FILE: Android/AnimatedSkyApp/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: Android/AnimatedSkyApp/settings.gradle
================================================
include ':app'
================================================
FILE: Android/BackgroundReplacementApp/.gitignore
================================================
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
*.iml
.idea
# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# Google Services (e.g. APIs or Firebase)
google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
================================================
FILE: Android/BackgroundReplacementApp/README.md
================================================
# Automatic Background Replacement with People Segmentation
[ ](https://app.codeship.com/projects/297281)
[](http://twitter.com/fritzlabs)
In this app, we create a mask of a person and then replace the background with any picture in the camera gallery.

For the full tutorial, visit [our post on Heartbeat](https://heartbeat.fritz.ai/image-segmentation-for-android-smart-background-replacement-with-fritz-a09d8b0592a4).
This example app uses the on-device People Segmentation API for Android.
- [Overview](https://www.fritz.ai/features/image-segmentation.html)
- [Documentation](https://docs.fritz.ai/develop/vision/image-segmentation/android.html)
## Fritz AI
Fritz AI is the machine learning platform for iOS and Android developers. Teach your mobile apps to see, hear, sense, and think. Start with our ready-to-use feature APIs or connect and deploy your own custom models.
## Requirements
- Android Studio 3.2 or above
- Android device in developer model (USB debugging enabled)
## Getting Started
**Step 1: Choose a Fritz AI Plan**
[Sign up](https://www.fritz.ai/pricing/?utm_source=github&utm_campaign=fritz-examples) for a Fritz AI plan to get started.
Register the Android app in your Fritz account with the package id "ai.fritz.backgroundChanger". During registration, you'll receive an API key for the app. Save this for later. To find it in the webapp, you can go to Project Settings > Apps > Your App > Show API Key.
**Step 2: Clone / Fork the fritz-examples repository and open the BackgroundReplacementApp app in Android Studio**
```
git clone https://github.com/fritzlabs/fritz-examples.git
```
In Android Studio, choose "Open an existing Android Studio project" and select `BackgroundReplacementApp`.
**Step 3: Edit the fritz.xml file with your API Key**
In app/src/main/res/values/fritz.xml, change the fritz_api_key attribute with the one you received in step 1.
**Step 4: Build the Android Studio Project**
Select "Build > Make Project" from the top nav. Download any missing libraries if applicable. This should sync the gradle dependencies so give the build a second to complete.
**Step 5: Install the app onto your device**
With your Android device connected, select `Run > Run App` from the top nav. When running the app for the first time, you'll have to give permissions to access the camera. After the app is installed and running, take a picture of a person and then after that mask is created, select a photo from your camera gallery to replace the background.
## Official Documentation
[SDK Documentation](https://docs.fritz.ai/?utm_source=github&utm_campaign=fritz-examples)
[Android API Docs](https://docs.fritz.ai/android/latest/index.html?utm_source=github&utm_campaign=fritz-examples)
## Join the community
[Heartbeat](https://heartbeat.fritz.ai/?utm_source=github&utm_campaign=fritz-examples) is a community of developers interested in the intersection of mobile and machine learning. [Chat with us in Slack](https://www.fritz.ai/slack) and stay up to date on the latest mobile ML news with our [Newsletter](https://www.fritz.ai/newsletter?utm_source=github&utm_campaign=fritz-examples).
## Help
For any questions or issues, you can:
- Submit an issue on this repo
- Go to [Support](https://support.fritz.ai/?utm_source=github&utm_campaign=fritz-examples)
- Message us directly in [Slack](https://www.fritz.ai/slack)
================================================
FILE: Android/BackgroundReplacementApp/app/.gitignore
================================================
/build
================================================
FILE: Android/BackgroundReplacementApp/app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
// MUST MATCH THE APPLICATION YOU CREATE IN FRITZ
applicationId "ai.fritz.backgroundChanger"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation "ai.fritz:core:6.0.3"
implementation "ai.fritz:vision:6.0.3"
implementation "ai.fritz:vision-people-segmentation-model-accurate:3.1.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
================================================
FILE: Android/BackgroundReplacementApp/app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ai.fritz.replaceBackground">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:largeHeap="true"
android:theme="@style/AppTheme">
<activity android:name="ai.fritz.replaceBackground.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="ai.fritz.core.FritzCustomModelService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
</manifest>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/AutoFitTextureView.java
================================================
package ai.fritz.replaceBackground;
import android.content.Context;
import android.util.AttributeSet;
import android.view.TextureView;
/**
* A {@link TextureView} that can be adjusted to a specified aspect ratio.
*/
public class AutoFitTextureView extends TextureView {
private int ratioWidth = 0;
private int ratioHeight = 0;
public AutoFitTextureView(final Context context) {
this(context, null);
}
public AutoFitTextureView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public AutoFitTextureView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
/**
* Sets the aspect ratio for this view. The size of the view will be measured based on the ratio
* calculated from the parameters. Note that the actual sizes of parameters don't matter, that
* is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result.
*
* @param width Relative horizontal size
* @param height Relative vertical size
*/
public void setAspectRatio(final int width, final int height) {
if (width < 0 || height < 0) {
throw new IllegalArgumentException("Size cannot be negative.");
}
ratioWidth = width;
ratioHeight = height;
requestLayout();
}
}
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/BaseCameraActivity.java
================================================
package ai.fritz.replaceBackground;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.ImageReader.OnImageAvailableListener;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Size;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.widget.Toast;
public abstract class BaseCameraActivity extends AppCompatActivity implements OnImageAvailableListener {
private static final String TAG = BaseCameraActivity.class.getSimpleName();
private static int MAX_WIDTH = 500;
private static final int PERMISSIONS_REQUEST = 1;
private static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;
private static final String PERMISSION_STORAGE = Manifest.permission.WRITE_EXTERNAL_STORAGE;
private boolean useCamera2API;
private boolean debug = false;
private Handler handler;
private HandlerThread handlerThread;
protected String cameraId;
@Override
protected void onCreate(final Bundle savedInstanceState) {
Log.d(TAG, "onCreate " + this);
super.onCreate(null);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
if (hasPermission()) {
setFragment();
} else {
requestPermission();
}
}
@Override
public synchronized void onStart() {
Log.d(TAG, "onStart " + this);
super.onStart();
}
@Override
public synchronized void onResume() {
Log.d(TAG, "onResume " + this);
super.onResume();
handlerThread = new HandlerThread("inference");
handlerThread.start();
handler = new Handler(handlerThread.getLooper());
}
@Override
public synchronized void onPause() {
Log.d(TAG, "onPause " + this);
handlerThread.quitSafely();
try {
handlerThread.join();
handlerThread = null;
handler = null;
} catch (final InterruptedException e) {
Log.e(TAG, "Exception!" + e);
}
super.onPause();
}
@Override
public synchronized void onStop() {
Log.d(TAG, "onStop " + this);
super.onStop();
}
@Override
public synchronized void onDestroy() {
Log.d(TAG, "onDestroy " + this);
super.onDestroy();
}
protected synchronized void runInBackground(final Runnable r) {
if (handler != null) {
handler.post(r);
}
}
@Override
public void onRequestPermissionsResult(
final int requestCode, final String[] permissions, final int[] grantResults) {
switch (requestCode) {
case PERMISSIONS_REQUEST: {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED
&& grantResults[1] == PackageManager.PERMISSION_GRANTED) {
setFragment();
} else {
requestPermission();
}
}
}
}
private boolean hasPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return checkSelfPermission(PERMISSION_CAMERA) == PackageManager.PERMISSION_GRANTED && checkSelfPermission(PERMISSION_STORAGE) == PackageManager.PERMISSION_GRANTED;
} else {
return true;
}
}
private void requestPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (shouldShowRequestPermissionRationale(PERMISSION_CAMERA) || shouldShowRequestPermissionRationale(PERMISSION_STORAGE)) {
Toast.makeText(BaseCameraActivity.this, "Camera AND storage permission are required for this demo", Toast.LENGTH_LONG).show();
}
requestPermissions(new String[]{PERMISSION_CAMERA, PERMISSION_STORAGE}, PERMISSIONS_REQUEST);
}
}
protected void setFragment() {
cameraId = chooseCamera();
final CameraConnectionFragment fragment =
CameraConnectionFragment.newInstance(
new CameraConnectionFragment.ConnectionCallback() {
@Override
public void onPreviewSizeChosen(final Size previewSize, final Size cameraViewSize, final int rotation) {
BaseCameraActivity.this.onPreviewSizeChosen(previewSize, cameraViewSize, rotation);
}
},
this,
getLayoutId(),
getDesiredPreviewFrameSize());
fragment.setCamera(cameraId);
getFragmentManager()
.beginTransaction()
.replace(R.id.camera_container, fragment)
.commit();
}
private String chooseCamera() {
final CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
for (final String cameraId : manager.getCameraIdList()) {
final CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
// We don't use a front facing camera in this sample.
final Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
if (facing != null && facing == CameraCharacteristics.LENS_FACING_FRONT) {
continue;
}
final StreamConfigurationMap map =
characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (map == null) {
continue;
}
// Fallback to camera1 API for internal cameras that don't have full support.
// This should help with legacy situations where using the camera2 API causes
// distorted or otherwise broken previews.
useCamera2API = (facing == CameraCharacteristics.LENS_FACING_EXTERNAL)
|| isHardwareLevelSupported(characteristics,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL);
Log.i(TAG, "Camera API lv2?: " + useCamera2API);
return cameraId;
}
} catch (CameraAccessException e) {
Log.e(TAG, "Not allowed to access camera: " + e);
}
return null;
}
// Returns true if the device supports the required hardware level, or better.
private boolean isHardwareLevelSupported(
CameraCharacteristics characteristics, int requiredLevel) {
int deviceLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
if (deviceLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
return requiredLevel == deviceLevel;
}
// deviceLevel is not LEGACY, can use numerical sort
return requiredLevel <= deviceLevel;
}
public boolean isDebug() {
return debug;
}
public void requestRender() {
final OverlayView overlay = (OverlayView) findViewById(R.id.debug_overlay);
if (overlay != null) {
overlay.postInvalidate();
}
}
public void setCallback(final OverlayView.DrawCallback callback) {
final OverlayView overlay = (OverlayView) findViewById(R.id.debug_overlay);
if (overlay != null) {
overlay.setCallback(callback);
}
}
public void onSetDebug(final boolean debug) {
}
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
debug = !debug;
requestRender();
onSetDebug(debug);
return true;
}
return super.onKeyDown(keyCode, event);
}
protected abstract void onPreviewSizeChosen(final Size previewSize, final Size cameraViewSize, final int rotation);
protected abstract int getLayoutId();
protected Size getDesiredPreviewFrameSize() {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float ratio = (float) metrics.heightPixels / metrics.widthPixels;
return new Size(MAX_WIDTH, (int) ratio * MAX_WIDTH);
}
}
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/CameraConnectionFragment.java
================================================
package ai.fritz.replaceBackground;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.ImageFormat;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.ImageReader;
import android.media.ImageReader.OnImageAvailableListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.util.Log;
import android.util.Size;
import android.view.LayoutInflater;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
public class CameraConnectionFragment extends Fragment {
private static final String TAG = CameraConnectionFragment.class.getSimpleName();
public CameraConnectionFragment() {
}
/**
* The camera preview size will be chosen to be the smallest frame by pixel size capable of
* containing a DESIRED_SIZE x DESIRED_SIZE square.
*/
private static final int MINIMUM_PREVIEW_SIZE = 320;
/**
* Conversion from screen rotation to JPEG orientation.
*/
private static final String FRAGMENT_DIALOG = "dialog";
/**
* {@link android.view.TextureView.SurfaceTextureListener} handles several lifecycle events on a
* {@link TextureView}.
*/
private final TextureView.SurfaceTextureListener surfaceTextureListener =
new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(
final SurfaceTexture texture, final int width, final int height) {
openCamera(width, height);
}
@Override
public void onSurfaceTextureSizeChanged(
final SurfaceTexture texture, final int width, final int height) {
configureTransform(width, height);
}
@Override
public boolean onSurfaceTextureDestroyed(final SurfaceTexture texture) {
return true;
}
@Override
public void onSurfaceTextureUpdated(final SurfaceTexture texture) {
}
};
/**
* Callback for Activities to use to initialize their data once the
* selected preview size is known.
*/
public interface ConnectionCallback {
void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraRotation);
}
/**
* ID of the current {@link CameraDevice}.
*/
private String cameraId;
/**
* An {@link AutoFitTextureView} for camera preview.
*/
private AutoFitTextureView textureView;
/**
* A {@link CameraCaptureSession } for camera preview.
*/
private CameraCaptureSession captureSession;
/**
* A reference to the opened {@link CameraDevice}.
*/
private CameraDevice cameraDevice;
/**
* The rotation in degrees of the camera sensor from the display.
*/
private Integer sensorOrientation;
/**
* The {@link android.util.Size} of camera preview.
*/
private Size previewSize;
/**
* {@link android.hardware.camera2.CameraDevice.StateCallback}
* is called when {@link CameraDevice} changes its state.
*/
private final CameraDevice.StateCallback stateCallback =
new CameraDevice.StateCallback() {
@Override
public void onOpened(final CameraDevice cd) {
// This method is called when the camera is opened. We start camera preview here.
cameraOpenCloseLock.release();
cameraDevice = cd;
createCameraPreviewSession();
}
@Override
public void onDisconnected(final CameraDevice cd) {
cameraOpenCloseLock.release();
cd.close();
cameraDevice = null;
}
@Override
public void onError(final CameraDevice cd, final int error) {
cameraOpenCloseLock.release();
cd.close();
cameraDevice = null;
final Activity activity = getActivity();
if (null != activity) {
activity.finish();
}
}
};
/**
* An additional thread for running tasks that shouldn't block the UI.
*/
private HandlerThread backgroundThread;
/**
* A {@link Handler} for running tasks in the background.
*/
private Handler backgroundHandler;
/**
* An {@link ImageReader} that handles preview frame capture.
*/
private ImageReader previewReader;
/**
* {@link android.hardware.camera2.CaptureRequest.Builder} for the camera preview
*/
private CaptureRequest.Builder previewRequestBuilder;
/**
* {@link CaptureRequest} generated by {@link #previewRequestBuilder}
*/
private CaptureRequest previewRequest;
/**
* A {@link Semaphore} to prevent the app from exiting before closing the camera.
*/
private final Semaphore cameraOpenCloseLock = new Semaphore(1);
/**
* A {@link OnImageAvailableListener} to receive frames as they are available.
*/
private OnImageAvailableListener imageListener = null;
/**
* The input size in pixels desired by TensorFlow (width and height of a square bitmap).
*/
private Size inputSize = null;
/**
* The layout identifier to inflate for this Fragment.
*/
private int layout = -1;
private ConnectionCallback cameraConnectionCallback = null;
private CameraConnectionFragment(
final ConnectionCallback connectionCallback,
final OnImageAvailableListener imageListener,
final int layout,
final Size inputSize) {
this.cameraConnectionCallback = connectionCallback;
this.imageListener = imageListener;
this.layout = layout;
this.inputSize = inputSize;
}
/**
* Shows a {@link Toast} on the UI thread.
*
* @param text The message to show
*/
private void showToast(final String text) {
final Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(
new Runnable() {
@Override
public void run() {
Toast.makeText(activity, text, Toast.LENGTH_SHORT).show();
}
});
}
}
/**
* Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
* width and height are at least as large as the minimum of both, or an exact match if possible.
*
* @param choices The list of sizes that the camera supports for the intended output class
* @param width The minimum desired width
* @param height The minimum desired height
* @return The optimal {@code Size}, or an arbitrary one if none were big enough
*/
protected static Size chooseOptimalSize(final Size[] choices, final int width, final int height) {
final int minSize = Math.max(Math.min(width, height), MINIMUM_PREVIEW_SIZE);
final Size desiredSize = new Size(width, height);
// Collect the supported resolutions that are at least as big as the preview Surface
boolean exactSizeFound = false;
final List<Size> bigEnough = new ArrayList<Size>();
final List<Size> tooSmall = new ArrayList<Size>();
for (final Size option : choices) {
if (option.equals(desiredSize)) {
// Set the size but don't return yet so that remaining sizes will still be logged.
exactSizeFound = true;
}
if (option.getHeight() >= minSize && option.getWidth() >= minSize) {
bigEnough.add(option);
} else {
tooSmall.add(option);
}
}
Log.d(TAG, "Desired size: " + desiredSize + ", min size: " + minSize + "x" + minSize);
Log.d(TAG, "Valid preview sizes: [" + TextUtils.join(", ", bigEnough) + "]");
Log.d(TAG, "Rejected preview sizes: [" + TextUtils.join(", ", tooSmall) + "]");
if (exactSizeFound) {
Log.d(TAG, "Exact size match found.");
return desiredSize;
}
// Pick the smallest of those, assuming we found any
if (bigEnough.size() > 0) {
final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
Log.d(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
return chosenSize;
} else {
Log.e(TAG, "Couldn't find any suitable preview size");
return choices[0];
}
}
public static CameraConnectionFragment newInstance(
final ConnectionCallback callback,
final OnImageAvailableListener imageListener,
final int layout,
final Size inputSize) {
return new CameraConnectionFragment(callback, imageListener, layout, inputSize);
}
@Override
public View onCreateView(
final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(layout, container, false);
}
@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
textureView = (AutoFitTextureView) view.findViewById(R.id.texture);
}
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
startBackgroundThread();
// When the screen is turned off and turned back on, the SurfaceTexture is already
// available, and "onSurfaceTextureAvailable" will not be called. In that case, we can open
// a camera and start preview from here (otherwise, we wait until the surface is ready in
// the SurfaceTextureListener).
if (textureView.isAvailable()) {
openCamera(textureView.getWidth(), textureView.getHeight());
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener);
}
}
@Override
public void onPause() {
closeCamera();
stopBackgroundThread();
super.onPause();
}
public void setCamera(String cameraId) {
this.cameraId = cameraId;
}
/**
* Sets up member variables related to camera.
*/
private void setUpCameraOutputs() {
final Activity activity = getActivity();
final CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
final CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
final StreamConfigurationMap map =
characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
// For still image captures, we use the largest available size.
final Size largest =
Collections.max(
Arrays.asList(map.getOutputSizes(ImageFormat.YUV_420_888)),
new CompareSizesByArea());
sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
// Danger, W.R.! Attempting to use too large a preview size could exceed the camera
// bus' bandwidth limitation, resulting in gorgeous previews but the storage of
// garbage capture data.
previewSize =
chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
inputSize.getWidth(),
inputSize.getHeight());
} catch (final CameraAccessException e) {
Log.e(TAG, "Exception!" + e);
} catch (final NullPointerException e) {
// Currently an NPE is thrown when the Camera2API is used but not supported on the
// device this code runs.
// TODO(andrewharp): abstract ErrorDialog/RuntimeException handling out into new method and
// reuse throughout app.
ErrorDialog.newInstance(getString(R.string.camera_error))
.show(getChildFragmentManager(), FRAGMENT_DIALOG);
throw new RuntimeException(getString(R.string.camera_error));
}
Size textureViewSize = new Size(textureView.getWidth(), textureView.getHeight());
cameraConnectionCallback.onPreviewSizeChosen(previewSize, textureViewSize, sensorOrientation);
}
/**
* Opens the camera specified by {@link CameraConnectionFragment#cameraId}.
*/
private void openCamera(final int width, final int height) {
setUpCameraOutputs();
configureTransform(width, height);
final Activity activity = getActivity();
final CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
if (!cameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("Time out waiting to lock camera opening.");
}
manager.openCamera(cameraId, stateCallback, backgroundHandler);
} catch (final CameraAccessException | SecurityException e) {
Log.e(TAG, "Exception!" + e);
} catch (final InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera opening.", e);
}
}
/**
* Closes the current {@link CameraDevice}.
*/
private void closeCamera() {
try {
cameraOpenCloseLock.acquire();
if (null != captureSession) {
captureSession.close();
captureSession = null;
}
if (null != cameraDevice) {
cameraDevice.close();
cameraDevice = null;
}
if (null != previewReader) {
previewReader.close();
previewReader = null;
}
} catch (final InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
} finally {
cameraOpenCloseLock.release();
}
}
/**
* Starts a background thread and its {@link Handler}.
*/
private void startBackgroundThread() {
backgroundThread = new HandlerThread("ImageListener");
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper());
}
/**
* Stops the background thread and its {@link Handler}.
*/
private void stopBackgroundThread() {
backgroundThread.quitSafely();
try {
backgroundThread.join();
backgroundThread = null;
backgroundHandler = null;
} catch (final InterruptedException e) {
Log.e(TAG, "Exception!" + e);
}
}
private final CameraCaptureSession.CaptureCallback captureCallback =
new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureProgressed(
final CameraCaptureSession session,
final CaptureRequest request,
final CaptureResult partialResult) {
}
@Override
public void onCaptureCompleted(
final CameraCaptureSession session,
final CaptureRequest request,
final TotalCaptureResult result) {
}
};
/**
* Creates a new {@link CameraCaptureSession} for camera preview.
*/
private void createCameraPreviewSession() {
try {
final SurfaceTexture texture = textureView.getSurfaceTexture();
assert texture != null;
// We configure the size of default buffer to be the size of camera preview we want.
texture.setDefaultBufferSize(previewSize.getWidth(), previewSize.getHeight());
// This is the output Surface we need to start preview.
final Surface surface = new Surface(texture);
// We set up a CaptureRequest.Builder with the output Surface.
previewRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
previewRequestBuilder.addTarget(surface);
Log.i(TAG, "Opening camera preview: " + previewSize.getWidth() + "x" + previewSize.getHeight());
// Create the reader for the preview frames.
previewReader =
ImageReader.newInstance(
previewSize.getWidth(), previewSize.getHeight(), ImageFormat.YUV_420_888, 2);
previewReader.setOnImageAvailableListener(imageListener, backgroundHandler);
previewRequestBuilder.addTarget(previewReader.getSurface());
// Here, we create a CameraCaptureSession for camera preview.
cameraDevice.createCaptureSession(
Arrays.asList(surface, previewReader.getSurface()),
new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(final CameraCaptureSession cameraCaptureSession) {
// The camera is already closed
if (null == cameraDevice) {
return;
}
// When the session is ready, we start displaying the preview.
captureSession = cameraCaptureSession;
try {
// Auto focus should be continuous for camera preview.
previewRequestBuilder.set(
CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
// Flash is automatically enabled when necessary.
previewRequestBuilder.set(
CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
// Finally, we start displaying the camera preview.
previewRequest = previewRequestBuilder.build();
captureSession.setRepeatingRequest(
previewRequest, captureCallback, backgroundHandler);
} catch (final CameraAccessException e) {
Log.e(TAG, "Exception!" + e);
}
}
@Override
public void onConfigureFailed(final CameraCaptureSession cameraCaptureSession) {
showToast("Failed");
}
},
null);
} catch (final CameraAccessException e) {
Log.e(TAG, "Exception!" + e);
}
}
/**
* Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`.
* This method should be called after the camera preview size is determined in
* setUpCameraOutputs and also the size of `mTextureView` is fixed.
*
* @param viewWidth The width of `mTextureView`
* @param viewHeight The height of `mTextureView`
*/
private void configureTransform(final int viewWidth, final int viewHeight) {
final Activity activity = getActivity();
if (null == textureView || null == previewSize || null == activity) {
return;
}
final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
final Matrix matrix = new Matrix();
final RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
final RectF bufferRect = new RectF(0, 0, previewSize.getHeight(), previewSize.getWidth());
final float centerX = viewRect.centerX();
final float centerY = viewRect.centerY();
if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
final float scale =
Math.max(
(float) viewHeight / previewSize.getHeight(),
(float) viewWidth / previewSize.getWidth());
matrix.postScale(scale, scale, centerX, centerY);
matrix.postRotate(90 * (rotation - 2), centerX, centerY);
} else if (Surface.ROTATION_180 == rotation) {
matrix.postRotate(180, centerX, centerY);
}
textureView.setTransform(matrix);
}
/**
* Compares two {@code Size}s based on their areas.
*/
static class CompareSizesByArea implements Comparator<Size> {
@Override
public int compare(final Size lhs, final Size rhs) {
// We cast here to ensure the multiplications won't overflow
return Long.signum(
(long) lhs.getWidth() * lhs.getHeight() - (long) rhs.getWidth() * rhs.getHeight());
}
}
/**
* Shows an error message dialog.
*/
public static class ErrorDialog extends DialogFragment {
private static final String ARG_MESSAGE = "message";
public static ErrorDialog newInstance(final String message) {
final ErrorDialog dialog = new ErrorDialog();
final Bundle args = new Bundle();
args.putString(ARG_MESSAGE, message);
dialog.setArguments(args);
return dialog;
}
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Activity activity = getActivity();
return new AlertDialog.Builder(activity)
.setMessage(getArguments().getString(ARG_MESSAGE))
.setPositiveButton(
android.R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialogInterface, final int i) {
activity.finish();
}
})
.create();
}
}
}
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/MainActivity.java
================================================
package ai.fritz.replaceBackground;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.media.ExifInterface;
import android.media.Image;
import android.media.ImageReader;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.util.Size;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Toast;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicBoolean;
import ai.fritz.core.Fritz;
import ai.fritz.core.utils.BitmapUtils;
import ai.fritz.vision.FritzVision;
import ai.fritz.vision.FritzVisionImage;
import ai.fritz.vision.FritzVisionModels;
import ai.fritz.vision.FritzVisionOrientation;
import ai.fritz.vision.ImageOrientation;
import ai.fritz.vision.ImageRotation;
import ai.fritz.vision.ModelVariant;
import ai.fritz.vision.imagesegmentation.FritzVisionSegmentationPredictor;
import ai.fritz.vision.imagesegmentation.FritzVisionSegmentationPredictorOptions;
import ai.fritz.vision.imagesegmentation.FritzVisionSegmentationResult;
import ai.fritz.vision.imagesegmentation.MaskClass;
import ai.fritz.vision.imagesegmentation.SegmentationOnDeviceModel;
public class MainActivity extends BaseCameraActivity implements ImageReader.OnImageAvailableListener {
private static final String TAG = MainActivity.class.getSimpleName();
private static final int SELECT_IMAGE = 1;
private AtomicBoolean shouldSample = new AtomicBoolean(true);
private FritzVisionSegmentationPredictor predictor;
private ImageOrientation orientation;
private FritzVisionSegmentationResult segmentResult;
private FritzVisionImage visionImage;
Button snapshotButton;
Button selectBackgroundBtn;
RelativeLayout previewLayout;
RelativeLayout snapshotLayout;
OverlayView snapshotOverlay;
ProgressBar snapshotProcessingSpinner;
Button closeButton;
private Bitmap backgroundBitmap;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fritz.configure(getApplicationContext(), "bbe75c73f8b24e63bc05bf81ed9d2829");
SegmentationOnDeviceModel onDeviceModel = FritzVisionModels.getPeopleSegmentationOnDeviceModel(ModelVariant.ACCURATE);
FritzVisionSegmentationPredictorOptions options = new FritzVisionSegmentationPredictorOptions();
options.confidenceThreshold = .4f;
predictor = FritzVision.ImageSegmentation.getPredictor(onDeviceModel, options);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode != SELECT_IMAGE) {
return;
}
if (resultCode == Activity.RESULT_CANCELED) {
Toast.makeText(this, "Canceled", Toast.LENGTH_SHORT).show();
return;
}
if (resultCode == Activity.RESULT_OK) {
if (data == null) {
return;
}
try {
Uri selectedPicture = data.getData();
Log.d(TAG, "IMAGE CHOSEN: " + selectedPicture);
InputStream inputStream = getContentResolver().openInputStream(selectedPicture);
ExifInterface exif = new ExifInterface(inputStream);
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
backgroundBitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), selectedPicture);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
backgroundBitmap = BitmapUtils.rotate(backgroundBitmap, 0);
case ExifInterface.ORIENTATION_ROTATE_180:
backgroundBitmap = BitmapUtils.rotate(backgroundBitmap, 270);
case ExifInterface.ORIENTATION_ROTATE_270:
backgroundBitmap = BitmapUtils.rotate(backgroundBitmap, 180);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
@Override
protected int getLayoutId() {
return R.layout.camera_connection_fragment_background_replace;
}
@Override
public void onPreviewSizeChosen(final Size size, final Size cameraSize, final int rotation) {
orientation = FritzVisionOrientation.getImageOrientationFromCamera(this, cameraId);
snapshotButton = findViewById(R.id.take_picture_btn);
previewLayout = findViewById(R.id.preview_frame);
snapshotLayout = findViewById(R.id.snapshot_frame);
snapshotOverlay = findViewById(R.id.snapshot_view);
closeButton = findViewById(R.id.close_btn);
snapshotProcessingSpinner = findViewById(R.id.snapshotProcessingSpinner);
selectBackgroundBtn = findViewById(R.id.selectBackgroundBtn);
snapshotOverlay.setCallback(new OverlayView.DrawCallback() {
@Override
public void drawCallback(final Canvas canvas) {
// If the prediction has not run
if (segmentResult == null) {
return;
}
// Show the people segmentation result when the background hasn't been chosen.
if (backgroundBitmap == null) {
Bitmap personMask = segmentResult.buildSingleClassMask(MaskClass.PERSON, 180, .5f, .5f);
Bitmap result = visionImage.overlay(personMask);
Bitmap scaledBitmap = BitmapUtils.resize(result, cameraSize.getWidth(), cameraSize.getHeight());
canvas.drawBitmap(scaledBitmap, new Matrix(), new Paint());
return;
}
// Show the background replacement
Bitmap scaledBackgroundBitmap = BitmapUtils.resize(backgroundBitmap, cameraSize.getWidth(), cameraSize.getHeight());
canvas.drawBitmap(scaledBackgroundBitmap, new Matrix(), new Paint());
// Draw the masked bitmap
long startTime = System.currentTimeMillis();
// Use a max alpha of 255 so that there isn't any transparency in the mask.
Bitmap maskedBitmap = segmentResult.buildSingleClassMask(MaskClass.PERSON, 255, .5f, .5f);
Bitmap croppedMask = visionImage.mask(maskedBitmap, true);
Log.d(TAG, "Masked bitmap took " + (System.currentTimeMillis() - startTime) + "ms to create.");
if (croppedMask != null) {
// Scale the result
float scaleWidth = ((float) cameraSize.getWidth()) / croppedMask.getWidth();
float scaleHeight = ((float) cameraSize.getWidth()) / croppedMask.getHeight();
final Matrix matrix = new Matrix();
float scale = Math.min(scaleWidth, scaleHeight);
matrix.postScale(scale, scale);
Bitmap scaledMaskBitmap = Bitmap.createBitmap(croppedMask, 0, 0, croppedMask.getWidth(), croppedMask.getHeight(), matrix, false);
// Print the background bitmap with the masked bitmap
// Center the masked bitmap at the bottom of the image.
canvas.drawBitmap(scaledMaskBitmap, (cameraSize.getWidth() - scaledMaskBitmap.getWidth()) / 2, cameraSize.getHeight() - scaledMaskBitmap.getHeight(), new Paint());
}
}
});
snapshotButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!shouldSample.compareAndSet(true, false)) {
return;
}
snapshotOverlay.postInvalidate();
runInBackground(
new Runnable() {
@Override
public void run() {
showSpinner();
segmentResult = predictor.predict(visionImage);
showSnapshotLayout();
hideSpinner();
snapshotOverlay.postInvalidate();
}
});
}
});
selectBackgroundBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_IMAGE);
}
});
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showPreviewLayout();
shouldSample.set(true);
backgroundBitmap = null;
}
});
}
private void showSpinner() {
runOnUiThread(new Runnable() {
@Override
public void run() {
snapshotProcessingSpinner.setVisibility(View.VISIBLE);
}
});
}
private void hideSpinner() {
runOnUiThread(new Runnable() {
@Override
public void run() {
snapshotProcessingSpinner.setVisibility(View.GONE);
}
});
}
private void showSnapshotLayout() {
runOnUiThread(new Runnable() {
@Override
public void run() {
previewLayout.setVisibility(View.GONE);
snapshotLayout.setVisibility(View.VISIBLE);
}
});
}
private void showPreviewLayout() {
previewLayout.setVisibility(View.VISIBLE);
snapshotLayout.setVisibility(View.GONE);
}
@Override
public void onImageAvailable(final ImageReader reader) {
Image image = reader.acquireLatestImage();
if (image == null) {
return;
}
if (!shouldSample.get()) {
image.close();
return;
}
visionImage = FritzVisionImage.fromMediaImage(image, orientation);
image.close();
}
}
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/OverlayView.java
================================================
package ai.fritz.replaceBackground;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
/**
* A simple View providing a render callback to other classes.
*/
public class OverlayView extends View {
private DrawCallback callback;
public OverlayView(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
/**
* Interface defining the callback for client classes.
*/
public interface DrawCallback {
public void drawCallback(final Canvas canvas);
}
public void setCallback(final DrawCallback callback) {
this.callback = callback;
}
@Override
public synchronized void draw(final Canvas canvas) {
super.draw(canvas);
if(callback != null) {
callback.drawCallback(canvas);
}
}
}
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/drawable/ic_close.xml
================================================
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFF"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/drawable/ic_launcher_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/drawable/round_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:color="#FFFF"
android:width="5dip"/>
<size android:width="100dp" android:height="100dp"/>
</shape>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
================================================
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/layout/activity_main.xml
================================================
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/camera_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.constraint.ConstraintLayout>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/layout/camera_connection_fragment_background_replace.xml
================================================
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/preview_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ai.fritz.replaceBackground.AutoFitTextureView
android:id="@+id/texture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<ai.fritz.replaceBackground.OverlayView
android:id="@+id/debug_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/margin_sm"
android:layout_marginBottom="@dimen/margin_lg">
<Button
android:id="@+id/take_picture_btn"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:background="@drawable/round_button"
android:textColor="#fff" />
<ProgressBar
android:id="@+id/snapshotProcessingSpinner"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminateTint="#fff"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/snapshot_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ai.fritz.replaceBackground.OverlayView
android:id="@+id/snapshot_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
<Button
android:id="@+id/selectBackgroundBtn"
android:text="Replace Background"
android:textAlignment="gravity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:textStyle="bold"
android:textColor="#fff" />
<Button
android:id="@+id/close_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/margin_sm"
android:layout_marginRight="@dimen/margin_sm"
android:background="@drawable/ic_close" />
</RelativeLayout>
</RelativeLayout>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/values/dimen.xml
================================================
<!--
Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
<dimen name="margin_xs">4dp</dimen>
<dimen name="margin_sm">8dp</dimen>
<dimen name="margin_md">16dp</dimen>
<dimen name="margin_lg">32dp</dimen>
<dimen name="margin_xl">64dp</dimen>
<!-- Semantic definitions -->
<dimen name="horizontal_page_margin">@dimen/margin_md</dimen>
<dimen name="vertical_page_margin">@dimen/margin_md</dimen>
</resources>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/values/fritz.xml
================================================
<resources>
<string name="fritz_api_key">Your API Key</string>
</resources>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">Background Changer</string>
<string name="camera_error">This device doesn\'t support Camera2 API.</string>
</resources>
================================================
FILE: Android/BackgroundReplacementApp/app/src/main/res/values/styles.xml
================================================
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
================================================
FILE: Android/BackgroundReplacementApp/build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// ADD FOR FRITZ DEPENDENCIES
maven { url "https://fritz.mycloudrepo.io/public/repositories/android" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: Android/BackgroundReplacementApp/gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
================================================
FILE: Android/BackgroundReplacementApp/gradlew
================================================
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
================================================
FILE: Android/BackgroundReplacementApp/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: Android/BackgroundReplacementApp/settings.gradle
================================================
include ':app'
================================================
FILE: Android/CameraBoilerplateApp/.gitignore
================================================
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
*.iml
.idea
# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# Google Services (e.g. APIs or Firebase)
google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
================================================
FILE: Android/CameraBoilerplateApp/README.md
================================================
# Camera Boilerplate
[ ](https://app.codeship.com/projects/297281)
[](http://twitter.com/fritzlabs)
We've created this simple camera app to make it easier for developers to try out ML models using the Camera 2 API.
For a full list of tutorials, please visit our [examples and tutorials page](https://www.fritz.ai/resources/tutorials.html).
## Fritz AI
Fritz AI is the machine learning platform for iOS and Android developers. Teach your mobile apps to see, hear, sense, and think. Start with our ready-to-use feature APIs or connect and deploy your own custom models.
## Requirements
- Android Studio 3.2 or above
- Android device in developer model (USB debugging enabled)
## Getting Started
**Step 1: Choose a Fritz AI Plan**
[Sign up](https://www.fritz.ai/pricing/?utm_source=github&utm_campaign=fritz-examples) for a Fritz AI plan to get started.
Register the Android app in your Fritz account with the package id "ai.fritz.camera". During registration, you'll receive an API key for the app. Save this for later. To find it in the webapp, you can go to Project Settings > Apps > Your App > Show API Key.
**Step 2: Clone / Fork the fritz-examples repository and open the camera app in Android Studio**
```
git clone https://github.com/fritzlabs/fritz-examples.git
```
In Android Studio, choose "Open an existing Android Studio project" and select `skeleton-live-video-app`.
**Step 3: Edit the fritz.xml file with your API Key**
In app/src/main/res/values/fritz.xml, change the fritz_api_key attribute with the one you received in step 1.
**Step 4: Build the Android Studio Project**
Select "Build > Make Project" from the top nav. Download any missing libraries if applicable. This should sync the gradle dependencies so give the build a second to complete.
**Step 5: Install the app onto your device**
With your Android device connected, select `Run > Run App` from the top nav. You should see a simple camera app for you to play around with.
In future tutorials, we'll use this as a starting point in order to run the model on each camera frame and show the result.
## Official Documentation
[SDK Documentation](https://docs.fritz.ai/?utm_source=github&utm_campaign=fritz-examples)
[Android API Docs](https://docs.fritz.ai/android/latest/index.html?utm_source=github&utm_campaign=fritz-examples)
## Join the community
[Heartbeat](https://heartbeat.fritz.ai/?utm_source=github&utm_campaign=fritz-examples) is a community of developers interested in the intersection of mobile and machine learning. [Chat with us in Slack](https://www.fritz.ai/slack?utm_source=github&utm_campaign=fritz-examples) and stay up to date on the latest mobile ML news with our [Newsletter](https://www.fritz.ai/newsletter?utm_source=github&utm_campaign=fritz-examples).
## Help
For any questions or issues, you can:
- Submit an issue on this repo
- Go to [Support](https://support.fritz.ai/?utm_source=github&utm_campaign=fritz-examples)
- Message us directly in [Slack](https://www.fritz.ai/slack?utm_source=github&utm_campaign=fritz-examples)
================================================
FILE: Android/CameraBoilerplateApp/app/.gitignore
================================================
/build
================================================
FILE: Android/CameraBoilerplateApp/app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
// MUST MATCH THE APPLICATION YOU CREATE IN FRITZ
applicationId "ai.fritz.camera"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "ai.fritz:core:6.0.3"
implementation "ai.fritz:vision:6.0.3"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
================================================
FILE: Android/CameraBoilerplateApp/app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: Android/CameraBoilerplateApp/app/src/androidTest/java/ai/fritz/camera/ExampleInstrumentedTest.java
================================================
package ai.fritz.camera;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ai.fritz.camera", appContext.getPackageName());
}
}
================================================
FILE: Android/CameraBoilerplateApp/app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ai.fritz.camera">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:largeHeap="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/AutoFitTextureView.java
================================================
package ai.fritz.camera;
import android.content.Context;
import android.util.AttributeSet;
import android.view.TextureView;
/**
* A {@link TextureView} that can be adjusted to a specified aspect ratio.
*/
public class AutoFitTextureView extends TextureView {
private int ratioWidth = 0;
private int ratioHeight = 0;
public AutoFitTextureView(final Context context) {
this(context, null);
}
public AutoFitTextureView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public AutoFitTextureView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
/**
* Sets the aspect ratio for this view. The size of the view will be measured based on the ratio
* calculated from the parameters. Note that the actual sizes of parameters don't matter, that
* is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result.
*
* @param width Relative horizontal size
* @param height Relative vertical size
*/
public void setAspectRatio(final int width, final int height) {
if (width < 0 || height < 0) {
throw new IllegalArgumentException("Size cannot be negative.");
}
ratioWidth = width;
ratioHeight = height;
requestLayout();
}
}
================================================
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/BaseCameraActivity.java
================================================
package ai.fritz.camera;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.ImageReader.OnImageAvailableListener;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Size;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.widget.Toast;
public abstract class BaseCameraActivity extends AppCompatActivity implements OnImageAvailableListener {
private static final String TAG = BaseCameraActivity.class.getSimpleName();
private static int MAX_WIDTH = 500;
private static final int PERMISSIONS_REQUEST = 1;
private static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;
private boolean useCamera2API;
private boolean debug = false;
private Handler handler;
private HandlerThread handlerThread;
protected String cameraId;
@Override
protected void onCreate(final Bundle savedInstanceState) {
Log.d(TAG, "onCreate " + this);
super.onCreate(null);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
if (hasPermission()) {
setFragment();
} else {
requestPermission();
}
}
@Override
public synchronized void onStart() {
Log.d(TAG, "onStart " + this);
super.onStart();
}
@Override
public synchronized void onResume() {
Log.d(TAG, "onResume " + this);
super.onResume();
handlerThread = new HandlerThread("inference");
handlerThread.start();
handler = new Handler(handlerThread.getLooper());
}
@Override
public synchronized void onPause() {
Log.d(TAG, "onPause " + this);
if (!isFinishing()) {
Log.d(TAG, "Requesting finish");
finish();
}
handlerThread.quitSafely();
try {
handlerThread.join();
handlerThread = null;
handler = null;
} catch (final InterruptedException e) {
Log.e(TAG, "Exception!" + e);
}
super.onPause();
}
@Override
public synchronized void onStop() {
Log.d(TAG, "onStop " + this);
super.onStop();
}
@Override
public synchronized void onDestroy() {
Log.d(TAG, "onDestroy " + this);
super.onDestroy();
}
protected synchronized void runInBackground(final Runnable r) {
if (handler != null) {
handler.post(r);
}
}
@Override
public void onRequestPermissionsResult(
final int requestCode, final String[] permissions, final int[] grantResults) {
switch (requestCode) {
case PERMISSIONS_REQUEST: {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
setFragment();
} else {
requestPermission();
}
}
}
}
private boolean hasPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int permission = checkSelfPermission(PERMISSION_CAMERA);
return permission == PackageManager.PERMISSION_GRANTED;
} else {
return true;
}
}
private void requestPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (shouldShowRequestPermissionRationale(PERMISSION_CAMERA)) {
Toast.makeText(BaseCameraActivity.this, "Camera permission are required for this demo", Toast.LENGTH_LONG).show();
}
requestPermissions(new String[]{PERMISSION_CAMERA}, PERMISSIONS_REQUEST);
}
}
protected void setFragment() {
cameraId = chooseCamera();
final CameraConnectionFragment fragment =
CameraConnectionFragment.newInstance(
new CameraConnectionFragment.ConnectionCallback() {
@Override
public void onPreviewSizeChosen(final Size previewSize, final Size cameraViewSize, final int rotation) {
BaseCameraActivity.this.onPreviewSizeChosen(previewSize, cameraViewSize, rotation);
}
},
this,
getLayoutId(),
getDesiredPreviewFrameSize());
fragment.setCamera(cameraId);
getFragmentManager()
.beginTransaction()
.replace(R.id.camera_container, fragment)
.commit();
}
private String chooseCamera() {
final CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
for (final String cameraId : manager.getCameraIdList()) {
final CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
// We don't use a front facing camera in this sample.
final Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
if (facing != null && facing == CameraCharacteristics.LENS_FACING_FRONT) {
continue;
}
final StreamConfigurationMap map =
characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (map == null) {
continue;
}
// Fallback to camera1 API for internal cameras that don't have full support.
// This should help with legacy situations where using the camera2 API causes
// distorted or otherwise broken previews.
useCamera2API = (facing == CameraCharacteristics.LENS_FACING_EXTERNAL)
|| isHardwareLevelSupported(characteristics,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL);
Log.i(TAG, "Camera API lv2?: " + useCamera2API);
return cameraId;
}
} catch (CameraAccessException e) {
Log.e(TAG, "Not allowed to access camera: " + e);
}
return null;
}
// Returns true if the device supports the required hardware level, or better.
private boolean isHardwareLevelSupported(
CameraCharacteristics characteristics, int requiredLevel) {
int deviceLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
if (deviceLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
return requiredLevel == deviceLevel;
}
// deviceLevel is not LEGACY, can use numerical sort
return requiredLevel <= deviceLevel;
}
public boolean isDebug() {
return debug;
}
public void requestRender() {
final OverlayView overlay = (OverlayView) findViewById(R.id.debug_overlay);
if (overlay != null) {
overlay.postInvalidate();
}
}
public void setCallback(final OverlayView.DrawCallback callback) {
final OverlayView overlay = (OverlayView) findViewById(R.id.debug_overlay);
if (overlay != null) {
overlay.setCallback(callback);
}
}
public void onSetDebug(final boolean debug) {
}
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
debug = !debug;
requestRender();
onSetDebug(debug);
return true;
}
return super.onKeyDown(keyCode, event);
}
protected abstract void onPreviewSizeChosen(final Size previewSize, final Size cameraViewSize, final int rotation);
protected abstract int getLayoutId();
protected Size getDesiredPreviewFrameSize() {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float ratio = (float) metrics.heightPixels / metrics.widthPixels;
return new Size(MAX_WIDTH, (int) ratio * MAX_WIDTH);
}
}
================================================
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/CameraConnectionFragment.java
================================================
package ai.fritz.camera;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.ImageFormat;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.ImageReader;
import android.media.ImageReader.OnImageAvailableListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.util.Log;
import android.util.Size;
import android.view.LayoutInflater;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
public class CameraConnectionFragment extends Fragment {
private static final String TAG = CameraConnectionFragment.class.getSimpleName();
public CameraConnectionFragment() {
}
/**
* The camera preview size will be chosen to be the smallest frame by pixel size capable of
* containing a DESIRED_SIZE x DESIRED_SIZE square.
*/
private static final int MINIMUM_PREVIEW_SIZE = 320;
/**
* Conversion from screen rotation to JPEG orientation.
*/
private static final String FRAGMENT_DIALOG = "dialog";
/**
* {@link android.view.TextureView.SurfaceTextureListener} handles several lifecycle events on a
* {@link TextureView}.
*/
private final TextureView.SurfaceTextureListener surfaceTextureListener =
new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(
final SurfaceTexture texture, final int width, final int height) {
openCamera(width, height);
}
@Override
public void onSurfaceTextureSizeChanged(
final SurfaceTexture texture, final int width, final int height) {
configureTransform(width, height);
}
@Override
public boolean onSurfaceTextureDestroyed(final SurfaceTexture texture) {
return true;
}
@Override
public void onSurfaceTextureUpdated(final SurfaceTexture texture) {
}
};
/**
* Callback for Activities to use to initialize their data once the
* selected preview size is known.
*/
public interface ConnectionCallback {
void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraRotation);
}
/**
* ID of the current {@link CameraDevice}.
*/
private String cameraId;
/**
* An {@link AutoFitTextureView} for camera preview.
*/
private AutoFitTextureView textureView;
/**
* A {@link CameraCaptureSession } for camera preview.
*/
private CameraCaptureSession captureSession;
/**
* A reference to the opened {@link CameraDevice}.
*/
private CameraDevice cameraDevice;
/**
* The rotation in degrees of the camera sensor from the display.
*/
private Integer sensorOrientation;
/**
* The {@link android.util.Size} of camera preview.
*/
private Size previewSize;
/**
* {@link android.hardware.camera2.CameraDevice.StateCallback}
* is called when {@link CameraDevice} changes its state.
*/
private final CameraDevice.StateCallback stateCallback =
new CameraDevice.StateCallback() {
@Override
public void onOpened(final CameraDevice cd) {
// This method is called when the camera is opened. We start camera preview here.
cameraOpenCloseLock.release();
cameraDevice = cd;
createCameraPreviewSession();
}
@Override
public void onDisconnected(final CameraDevice cd) {
cameraOpenCloseLock.release();
cd.close();
cameraDevice = null;
}
@Override
public void onError(final CameraDevice cd, final int error) {
cameraOpenCloseLock.release();
cd.close();
cameraDevice = null;
final Activity activity = getActivity();
if (null != activity) {
activity.finish();
}
}
};
/**
* An additional thread for running tasks that shouldn't block the UI.
*/
private HandlerThread backgroundThread;
/**
* A {@link Handler} for running tasks in the background.
*/
private Handler backgroundHandler;
/**
* An {@link ImageReader} that handles preview frame capture.
*/
private ImageReader previewReader;
/**
* {@link android.hardware.camera2.CaptureRequest.Builder} for the camera preview
*/
private CaptureRequest.Builder previewRequestBuilder;
/**
* {@link CaptureRequest} generated by {@link #previewRequestBuilder}
*/
private CaptureRequest previewRequest;
/**
* A {@link Semaphore} to prevent the app from exiting before closing the camera.
*/
private final Semaphore cameraOpenCloseLock = new Semaphore(1);
/**
* A {@link OnImageAvailableListener} to receive frames as they are available.
*/
private OnImageAvailableListener imageListener = null;
/**
* The input size in pixels desired by TensorFlow (width and height of a square bitmap).
*/
private Size inputSize = null;
/**
* The layout identifier to inflate for this Fragment.
*/
private int layout = -1;
private ConnectionCallback cameraConnectionCallback = null;
private CameraConnectionFragment(
final ConnectionCallback connectionCallback,
final OnImageAvailableListener imageListener,
final int layout,
final Size inputSize) {
this.cameraConnectionCallback = connectionCallback;
this.imageListener = imageListener;
this.layout = layout;
this.inputSize = inputSize;
}
/**
* Shows a {@link Toast} on the UI thread.
*
* @param text The message to show
*/
private void showToast(final String text) {
final Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(
new Runnable() {
@Override
public void run() {
Toast.makeText(activity, text, Toast.LENGTH_SHORT).show();
}
});
}
}
/**
* Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
* width and height are at least as large as the minimum of both, or an exact match if possible.
*
* @param choices The list of sizes that the camera supports for the intended output class
* @param width The minimum desired width
* @param height The minimum desired height
* @return The optimal {@code Size}, or an arbitrary one if none were big enough
*/
protected static Size chooseOptimalSize(final Size[] choices, final int width, final int height) {
final int minSize = Math.max(Math.min(width, height), MINIMUM_PREVIEW_SIZE);
final Size desiredSize = new Size(width, height);
// Collect the supported resolutions that are at least as big as the preview Surface
boolean exactSizeFound = false;
final List<Size> bigEnough = new ArrayList<Size>();
final List<Size> tooSmall = new ArrayList<Size>();
for (final Size option : choices) {
if (option.equals(desiredSize)) {
// Set the size but don't return yet so that remaining sizes will still be logged.
exactSizeFound = true;
}
if (option.getHeight() >= minSize && option.getWidth() >= minSize) {
bigEnough.add(option);
} else {
tooSmall.add(option);
}
}
Log.d(TAG, "Desired size: " + desiredSize + ", min size: " + minSize + "x" + minSize);
Log.d(TAG, "Valid preview sizes: [" + TextUtils.join(", ", bigEnough) + "]");
Log.d(TAG, "Rejected preview sizes: [" + TextUtils.join(", ", tooSmall) + "]");
if (exactSizeFound) {
Log.d(TAG, "Exact size match found.");
return desiredSize;
}
// Pick the smallest of those, assuming we found any
if (bigEnough.size() > 0) {
final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
Log.d(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
return chosenSize;
} else {
Log.e(TAG, "Couldn't find any suitable preview size");
return choices[0];
}
}
public static CameraConnectionFragment newInstance(
final ConnectionCallback callback,
final OnImageAvailableListener imageListener,
final int layout,
final Size inputSize) {
return new CameraConnectionFragment(callback, imageListener, layout, inputSize);
}
@Override
public View onCreateView(
final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(layout, container, false);
}
@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
textureView = (AutoFitTextureView) view.findViewById(R.id.texture);
}
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
startBackgroundThread();
// When the screen is turned off and turned back on, the SurfaceTexture is already
// available, and "onSurfaceTextureAvailable" will not be called. In that case, we can open
// a camera and start preview from here (otherwise, we wait until the surface is ready in
// the SurfaceTextureListener).
if (textureView.isAvailable()) {
openCamera(textureView.getWidth(), textureView.getHeight());
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener);
}
}
@Override
public void onPause() {
closeCamera();
stopBackgroundThread();
super.onPause();
}
public void setCamera(String cameraId) {
this.cameraId = cameraId;
}
/**
* Sets up member variables related to camera.
*/
private void setUpCameraOutputs() {
final Activity activity = getActivity();
final CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
final CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
final StreamConfigurationMap map =
characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
// For still image captures, we use the largest available size.
final Size largest =
Collections.max(
Arrays.asList(map.getOutputSizes(ImageFormat.YUV_420_888)),
new CompareSizesByArea());
sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
// Danger, W.R.! Attempting to use too large a preview size could exceed the camera
// bus' bandwidth limitation, resulting in gorgeous previews but the storage of
// garbage capture data.
previewSize =
chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
inputSize.getWidth(),
inputSize.getHeight());
} catch (final CameraAccessException e) {
Log.e(TAG, "Exception!" + e);
} catch (final NullPointerException e) {
// Currently an NPE is thrown when the Camera2API is used but not supported on the
// device this code runs.
// TODO(andrewharp): abstract ErrorDialog/RuntimeException handling out into new met
gitextract_je7ujmkl/
├── .gitattributes
├── .gitignore
├── .swiftlint.yml
├── Android/
│ ├── .gitignore
│ ├── AnimatedSkyApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── animatedSky/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── sky_fragment.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimen.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── BackgroundReplacementApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── replaceBackground/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── camera_connection_fragment_background_replace.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimen.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── CameraBoilerplateApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ ├── androidTest/
│ │ │ │ └── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── ai/
│ │ │ │ │ └── fritz/
│ │ │ │ │ └── camera/
│ │ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ │ ├── LiveCameraActivity.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── OverlayView.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ ├── ic_close.xml
│ │ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ │ └── round_button.xml
│ │ │ │ ├── drawable-v24/
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── layout/
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ │ └── camera_connection_fragment_stylize.xml
│ │ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ └── values/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── fritz.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test/
│ │ │ └── java/
│ │ │ └── ai/
│ │ │ └── fritz/
│ │ │ └── camera/
│ │ │ └── ExampleUnitTest.java
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── FritzAIStudio/
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── coco_labels_list.txt
│ │ │ │ └── imagenet_comp_graph_label_strings.txt
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── aistudio/
│ │ │ │ ├── Navigation.java
│ │ │ │ ├── PredictorType.java
│ │ │ │ ├── activities/
│ │ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ │ ├── BaseLiveVideoActivity.java
│ │ │ │ │ ├── BaseRecordingActivity.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ ├── SplashActivity.java
│ │ │ │ │ ├── custommodel/
│ │ │ │ │ │ ├── CustomTFLiteActivity.java
│ │ │ │ │ │ └── ml/
│ │ │ │ │ │ ├── Classifier.java
│ │ │ │ │ │ └── MnistClassifier.java
│ │ │ │ │ └── vision/
│ │ │ │ │ ├── ImageLabelingActivity.java
│ │ │ │ │ ├── ImageSegmentationActivity.java
│ │ │ │ │ ├── ObjectDetectionActivity.java
│ │ │ │ │ ├── PoseEstimationActivity.java
│ │ │ │ │ └── StyleTransferActivity.java
│ │ │ │ ├── adapters/
│ │ │ │ │ ├── DemoAdapter.java
│ │ │ │ │ └── DemoItem.java
│ │ │ │ ├── fragments/
│ │ │ │ │ └── CameraConnectionFragment.java
│ │ │ │ ├── ui/
│ │ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ │ ├── ChooseModelDialog.java
│ │ │ │ │ ├── DrawModel.java
│ │ │ │ │ ├── DrawRenderer.java
│ │ │ │ │ ├── DrawView.java
│ │ │ │ │ ├── OverlayView.java
│ │ │ │ │ ├── RecognitionScoreView.java
│ │ │ │ │ ├── ResultsView.java
│ │ │ │ │ └── SeparatorDecoration.java
│ │ │ │ └── utils/
│ │ │ │ └── VideoProcessingQueue.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── circle.xml
│ │ │ │ ├── circle_white.xml
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_heartbeat_logo.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── round_button.xml
│ │ │ │ └── splash_bg.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── font/
│ │ │ │ ├── sf_display.xml
│ │ │ │ ├── sf_ui_display_bold.otf
│ │ │ │ ├── sf_ui_display_light.otf
│ │ │ │ └── sf_ui_display_regular.otf
│ │ │ ├── layout/
│ │ │ │ ├── activity_camera.xml
│ │ │ │ ├── activity_fritz_vision.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_mnist.xml
│ │ │ │ ├── activity_tfmobile_camera.xml
│ │ │ │ ├── app_bar.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── camera_connection_fragment_recording.xml
│ │ │ │ ├── camera_connection_fragment_stylize.xml
│ │ │ │ ├── camera_connection_fragment_tracking.xml
│ │ │ │ ├── camera_connection_snapshot.xml
│ │ │ │ ├── list_item_demo.xml
│ │ │ │ └── list_text_item.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── custom_models.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── ic_launcher_background.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── FritzVisionVideoApp/
│ │ ├── .gitignore
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ ├── androidTest/
│ │ │ │ └── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── fritzvisionvideo/
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── ai/
│ │ │ │ │ └── fritz/
│ │ │ │ │ └── fritzvisionvideo/
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ ├── VideoActivity.java
│ │ │ │ │ ├── strategies/
│ │ │ │ │ │ ├── MaskCutStrategy.java
│ │ │ │ │ │ ├── ObjectPoseStrategy.java
│ │ │ │ │ │ ├── PoseDoubleMaskStrategy.java
│ │ │ │ │ │ ├── StylizeBackgroundStrategy.java
│ │ │ │ │ │ ├── StylizeHairStrategy.java
│ │ │ │ │ │ ├── VideoFilterStrategy.java
│ │ │ │ │ │ └── customfilters/
│ │ │ │ │ │ └── StylizeHairFilter.java
│ │ │ │ │ └── ui/
│ │ │ │ │ ├── DemoAdapter.java
│ │ │ │ │ ├── DemoItem.java
│ │ │ │ │ └── SeparatorDecoration.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ └── ic_launcher_background.xml
│ │ │ │ ├── drawable-v24/
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── font/
│ │ │ │ │ ├── sf_display.xml
│ │ │ │ │ ├── sf_ui_display_bold.otf
│ │ │ │ │ ├── sf_ui_display_light.otf
│ │ │ │ │ └── sf_ui_display_regular.otf
│ │ │ │ ├── layout/
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── activity_video.xml
│ │ │ │ │ ├── app_bar.xml
│ │ │ │ │ └── list_item_demo.xml
│ │ │ │ ├── menu/
│ │ │ │ │ └── video_menu.xml
│ │ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ └── values/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── fritz.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test/
│ │ │ └── java/
│ │ │ └── ai/
│ │ │ └── fritz/
│ │ │ └── fritzvisionvideo/
│ │ │ └── ExampleUnitTest.java
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── HairColoringApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ ├── androidTest/
│ │ │ │ └── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── haircoloring/
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java/
│ │ │ │ │ └── ai/
│ │ │ │ │ └── fritz/
│ │ │ │ │ └── haircoloring/
│ │ │ │ │ ├── activities/
│ │ │ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ │ │ ├── BaseLiveGPUActivity.java
│ │ │ │ │ │ ├── LiveHairColorActivity.java
│ │ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ │ └── VideoHairColorActivity.java
│ │ │ │ │ ├── ui/
│ │ │ │ │ │ ├── DemoAdapter.java
│ │ │ │ │ │ ├── DemoItem.java
│ │ │ │ │ │ └── SeparatorDecoration.java
│ │ │ │ │ └── views/
│ │ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ │ └── OverlayView.java
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ ├── ic_close.xml
│ │ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ │ └── round_button.xml
│ │ │ │ ├── drawable-v24/
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── font/
│ │ │ │ │ ├── sf_display.xml
│ │ │ │ │ ├── sf_ui_display_bold.otf
│ │ │ │ │ ├── sf_ui_display_light.otf
│ │ │ │ │ └── sf_ui_display_regular.otf
│ │ │ │ ├── layout/
│ │ │ │ │ ├── activity_camera.xml
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── activity_video.xml
│ │ │ │ │ ├── camera_color_slider.xml
│ │ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ │ └── list_item_demo.xml
│ │ │ │ ├── menu/
│ │ │ │ │ └── video_menu.xml
│ │ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ └── values/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── fritz.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test/
│ │ │ └── java/
│ │ │ └── ai/
│ │ │ └── fritz/
│ │ │ └── haircoloring/
│ │ │ └── ExampleUnitTest.java
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── ImageLabelingApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── image_labeling_quantized_model.tflite
│ │ │ │ └── label_recording_model.json
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── main_camera.xml
│ │ │ │ ├── snapshot_button.xml
│ │ │ │ └── snapshot_overlay_frame.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── ObjectDetectionApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── detect.tflite
│ │ │ │ └── object_recording_model.json
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── main_camera.xml
│ │ │ │ ├── snapshot_button.xml
│ │ │ │ └── snapshot_overlay_frame.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── PetMonitoringApp/
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── petdetector/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── ic_warning.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── camera_connection_fragment_stylize.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── PetStickerApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── petSticker/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── camera_connection_fragment_pet_sticker.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimen.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── PoseEstimationApp/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── app/
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets/
│ │ │ │ ├── PoseMobilenet353x25758Large1565627685.tflite
│ │ │ │ └── pose_recording_model.json
│ │ │ ├── java/
│ │ │ │ └── ai/
│ │ │ │ └── fritz/
│ │ │ │ └── camera/
│ │ │ │ ├── AutoFitTextureView.java
│ │ │ │ ├── BaseCameraActivity.java
│ │ │ │ ├── CameraConnectionFragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── OverlayView.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ └── round_button.xml
│ │ │ ├── drawable-v24/
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── camera_connection_fragment.xml
│ │ │ │ ├── main_camera.xml
│ │ │ │ ├── snapshot_button.xml
│ │ │ │ └── snapshot_overlay_frame.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ └── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── fritz.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ └── README.md
├── LICENSE
├── README.md
├── SnapLensStudio/
│ └── README.md
└── iOS/
├── .gitignore
├── FritzAIStudio/
│ ├── FritzAIStudio/
│ │ ├── Media/
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ ├── SettingsIcon.imageset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── fritzLogo.imageset/
│ │ │ │ └── Contents.json
│ │ │ └── Base.lproj/
│ │ │ └── LaunchScreen.storyboard
│ │ ├── Source/
│ │ │ ├── Delegate/
│ │ │ │ └── AppDelegate.swift
│ │ │ ├── FritzCamera/
│ │ │ │ ├── FritzCamera/
│ │ │ │ │ ├── Delegates/
│ │ │ │ │ │ ├── CameraAVCaptureVideoDelegate.swift
│ │ │ │ │ │ └── CapturePhotoDelgate.swift
│ │ │ │ │ ├── Extensions/
│ │ │ │ │ │ ├── AVPhotoExtension.swift
│ │ │ │ │ │ ├── CameraResolutionExtension.swift
│ │ │ │ │ │ ├── CameraSessionExtensions.swift
│ │ │ │ │ │ ├── FritzCamera+CaptureDeviceExtensions.swift
│ │ │ │ │ │ ├── FritzCamera+Focus.swift
│ │ │ │ │ │ └── PhotoCaptureExtensions.swift
│ │ │ │ │ └── FritzCamera.swift
│ │ │ │ └── FritzCameraUI/
│ │ │ │ ├── CameraDelegateImplmentation.swift
│ │ │ │ ├── Extensions/
│ │ │ │ │ ├── ButtonFunctionality.swift
│ │ │ │ │ ├── CameraInterfaceHandler.swift
│ │ │ │ │ ├── DebugImageExtensions.swift
│ │ │ │ │ ├── FocusExtension.swift
│ │ │ │ │ └── GestureReconizerDelegateExtension.swift
│ │ │ │ ├── FritzCameraButton.swift
│ │ │ │ ├── FritzCameraControllerDelegate.swift
│ │ │ │ ├── FritzCameraViewController.swift
│ │ │ │ ├── FritzTextPromptView.swift
│ │ │ │ ├── Media.xcassets/
│ │ │ │ │ ├── Contents.json
│ │ │ │ │ ├── cameraFocus.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── cameraSwitch.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── cameraTorchAuto.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── cameraTorchOff.imageset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── cameraTorchOn.imageset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Shaders/
│ │ │ │ ├── DepthToGrayscale.metal
│ │ │ │ ├── Mixer.metal
│ │ │ │ ├── PassThrough.metal
│ │ │ │ └── RosyEffect.metal
│ │ │ └── Modules/
│ │ │ ├── Common/
│ │ │ │ ├── AIStudioFeaturePredictors.swift
│ │ │ │ ├── AIStudioImagePredictor.swift
│ │ │ │ ├── FritzModelDetails.swift
│ │ │ │ ├── ImagePredictorProtocol.swift
│ │ │ │ ├── Logging/
│ │ │ │ │ ├── Locks.swift
│ │ │ │ │ ├── LogHandler.swift
│ │ │ │ │ └── Logging.swift
│ │ │ │ ├── ModelGroupManager.swift
│ │ │ │ ├── PredictorOptionTypes.swift
│ │ │ │ └── Utils/
│ │ │ │ ├── FritzDeviceUtil.swift
│ │ │ │ └── FritzLogger.swift
│ │ │ ├── Demos/
│ │ │ │ ├── Cells/
│ │ │ │ │ ├── DemoTableViewCell.swift
│ │ │ │ │ └── LinkTableViewCell.swift
│ │ │ │ ├── Demos.storyboard
│ │ │ │ ├── DemosViewController.swift
│ │ │ │ └── NavigationController.swift
│ │ │ ├── FeatureController/
│ │ │ │ ├── ChooseModelController.swift
│ │ │ │ ├── ConfigureModelCells/
│ │ │ │ │ ├── ChooseColorCell.swift
│ │ │ │ │ ├── ChooseColorCell.xib
│ │ │ │ │ ├── ChooseModelCell.swift
│ │ │ │ │ ├── ChooseModelCell.xib
│ │ │ │ │ ├── RangeSliderCell.swift
│ │ │ │ │ ├── RangeSliderCell.xib
│ │ │ │ │ ├── SegmentSliderCell.swift
│ │ │ │ │ └── SegmentSliderCell.xib
│ │ │ │ ├── ConfigurePopover.swift
│ │ │ │ ├── Extensions/
│ │ │ │ │ ├── NavigationBarCustomization.swift
│ │ │ │ │ └── SettingsButtonInteractionExtension.swift
│ │ │ │ ├── FeatureContainer.xib
│ │ │ │ ├── FeatureOptions.swift
│ │ │ │ ├── FeatureViewController.swift
│ │ │ │ ├── ModelOptions.storyboard
│ │ │ │ └── SettingsButton.swift
│ │ │ ├── ImageSegmentation/
│ │ │ │ └── ImageSegFeature.swift
│ │ │ ├── ModelExtensions/
│ │ │ │ ├── ImageSegmentationFeature.swift
│ │ │ │ └── PoseEstimation+ImagePredictor.swift
│ │ │ ├── PredictorControllers/
│ │ │ │ ├── DetectObjects/
│ │ │ │ │ ├── DetectObjectsStoryboard.storyboard
│ │ │ │ │ └── DetectObjectsViewController.swift
│ │ │ │ ├── HairColor+ColorSlider.swift
│ │ │ │ ├── HairColorViewController.swift
│ │ │ │ ├── ImageSegmentationViewController.swift
│ │ │ │ ├── LabelImages/
│ │ │ │ │ ├── FritzVisionLabelViewController.swift
│ │ │ │ │ └── LabelImages.storyboard
│ │ │ │ ├── PoseEstimationViewController.swift
│ │ │ │ └── StyleTransferViewController.swift
│ │ │ └── Root/
│ │ │ ├── Root.storyboard
│ │ │ └── RootViewController.swift
│ │ └── Supporting Files/
│ │ └── Info.plist
│ ├── FritzAIStudio.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzAIStudio.xcscheme
│ ├── LICENSE
│ ├── Podfile
│ ├── README.md
│ └── fastlane/
│ ├── Appfile
│ ├── Deliverfile
│ └── Fastfile
├── FritzARKitDemo/
│ ├── ARKIt+Utilities.swift
│ ├── FritzARKitDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── ObjectDetectionViewController.swift
│ │ ├── SCNVector+Extensions.swift
│ │ ├── Utils.swift
│ │ ├── ViewController.swift
│ │ └── art.scnassets/
│ │ ├── box.scn
│ │ └── ship.scn
│ ├── FritzARKitDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzARKitDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzHairColorDemo/
│ ├── FritzHairColorDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Controllers/
│ │ │ ├── HairPredictor.swift
│ │ │ ├── LiveHairViewController.swift
│ │ │ ├── NavigationController.swift
│ │ │ ├── VideoHairViewController.swift
│ │ │ └── ViewController.swift
│ │ ├── Info.plist
│ │ ├── Storyboards/
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── LiveHairColorStoryboard.storyboard
│ │ │ ├── Main.storyboard
│ │ │ └── VideoHairViewStoryboard.storyboard
│ │ └── UI/
│ │ ├── DemoTableViewCell.swift
│ │ ├── LinkTableViewCell.swift
│ │ └── VideoPicker.swift
│ ├── FritzHairColorDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzHandPoseEstimationDemo/
│ ├── FritzHandPoseEstimationDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── CameraButton.swift
│ │ ├── DraggableKeypoint.swift
│ │ ├── HandPose.mlmodel
│ │ ├── HandPoseModel.swift
│ │ ├── Info.plist
│ │ ├── UIImageView+Transformations.swift
│ │ └── ViewController.swift
│ ├── FritzHandPoseEstimationDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzHandPoseEstimationDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzImageLabelingDemo/
│ ├── FritzImageLabelingDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── SceneDelegate.swift
│ │ └── ViewController.swift
│ ├── FritzImageLabelingDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzImageLabelingDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzImageSegmentationDemo/
│ ├── FritzImageSegmentationDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── CustomBlurView.swift
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzImageSegmentationDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzMaskRecognitionDemo/
│ ├── FritzMaskRecognitionDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── MaskRecognition.mlmodel
│ │ ├── SceneDelegate.swift
│ │ └── ViewController.swift
│ ├── FritzMaskRecognitionDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzMaskRecognitionDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzObjectDetectionDemo/
│ ├── FritzObjectDetectionDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── SceneDelegate.swift
│ │ └── ViewController.swift
│ ├── FritzObjectDetectionDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzObjectDetectionDemo.xcscheme
│ └── Podfile
├── FritzPetStickerDemo/
│ ├── FritzPetStickerDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzPetStickerDemo.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── FritzPetStickerDemo.xcscheme
│ ├── Podfile
│ └── README.md
├── FritzPizzaDetectorDemo/
│ ├── Final/
│ │ ├── FritzPizzaDetectorDemo/
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ └── pizza.imageset/
│ │ │ │ └── Contents.json
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── ViewController.swift
│ │ ├── FritzPizzaDetectorDemo.xcodeproj/
│ │ │ └── project.pbxproj
│ │ └── Podfile
│ ├── README.md
│ └── Starter/
│ ├── FritzPizzaDetectorDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ ├── Contents.json
│ │ │ └── pizza.imageset/
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzPizzaDetectorDemo.xcodeproj/
│ │ └── project.pbxproj
│ └── Podfile
├── FritzPoseEstimationDemo/
│ ├── FritzPoseEstimationDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzPoseEstimationDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzSkyReplacementDemo/
│ ├── FritzSkyReplacementDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzSkyReplacementDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzStyleTransferDemo/
│ ├── FritzStyleTransferDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── FritzStyleTransferDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
├── FritzVisionVideoDemo/
│ ├── FritzVisionVideoDemo/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ ├── Contents.json
│ │ │ └── ExportIcon.imageset/
│ │ │ └── Contents.json
│ │ ├── Controllers/
│ │ │ ├── NavigationController.swift
│ │ │ ├── SingleScreenViewController.swift
│ │ │ ├── SplitScreenViewController.swift
│ │ │ ├── Strategies/
│ │ │ │ ├── DoubleStyleStrategy.swift
│ │ │ │ ├── FemmesStrategy.swift
│ │ │ │ ├── ObjectPoseStrategy.swift
│ │ │ │ ├── PoseDoubleMaskStrategy.swift
│ │ │ │ ├── ScreamStrategy.swift
│ │ │ │ ├── StyleOptionStrategy.swift
│ │ │ │ ├── StylizeBackgroundStrategy.swift
│ │ │ │ ├── StylizeHairStrategy.swift
│ │ │ │ └── VideoOptionStrategy.swift
│ │ │ └── ViewController.swift
│ │ ├── Info.plist
│ │ ├── SceneDelegate.swift
│ │ ├── Storyboards/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ ├── Main.storyboard
│ │ │ ├── SingleScreenStoryboard.storyboard
│ │ │ └── SplitScreenStoryboard.storyboard
│ │ └── Utils/
│ │ └── StylizeHairMaskFilter.swift
│ ├── FritzVisionVideoDemo.xcodeproj/
│ │ └── project.pbxproj
│ ├── Podfile
│ └── README.md
└── README.md
SYMBOL INDEX (1059 symbols across 98 files)
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 15) | public AutoFitTextureView(Context context) {
method AutoFitTextureView (line 19) | public AutoFitTextureView(Context context, AttributeSet attrs) {
method AutoFitTextureView (line 23) | public AutoFitTextureView(Context context, AttributeSet attrs, int def...
method setAspectRatio (line 35) | public void setAspectRatio(int width, int height) {
method onMeasure (line 44) | @Override
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/BaseCameraActivity.java
class BaseCameraActivity (line 24) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 41) | @Override
method onStart (line 56) | @Override
method onResume (line 62) | @Override
method onPause (line 72) | @Override
method onStop (line 88) | @Override
method onDestroy (line 94) | @Override
method getCameraFacingDirection (line 100) | protected int getCameraFacingDirection() {
method runInBackground (line 104) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 110) | @Override
method hasPermission (line 126) | private boolean hasPermission() {
method requestPermission (line 135) | private void requestPermission() {
method setFragment (line 144) | protected void setFragment() {
method toggleCameraFacingDirection (line 166) | protected void toggleCameraFacingDirection() {
method chooseCamera (line 176) | private String chooseCamera() {
method isHardwareLevelSupported (line 212) | private boolean isHardwareLevelSupported(
method isDebug (line 223) | public boolean isDebug() {
method requestRender (line 227) | public void requestRender() {
method setCallback (line 234) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 241) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 244) | @Override
method onPreviewSizeChosen (line 255) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 257) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 259) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/CameraConnectionFragment.java
class CameraConnectionFragment (line 47) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 50) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 71) | @Override
method onSurfaceTextureSizeChanged (line 77) | @Override
method onSurfaceTextureDestroyed (line 83) | @Override
method onSurfaceTextureUpdated (line 88) | @Override
type ConnectionCallback (line 97) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 98) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 137) | @Override
method onDisconnected (line 145) | @Override
method onError (line 152) | @Override
method CameraConnectionFragment (line 212) | private CameraConnectionFragment(
method showToast (line 228) | private void showToast(final String text) {
method chooseOptimalSize (line 250) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 291) | public static CameraConnectionFragment newInstance(
method onCreateView (line 299) | @Override
method onViewCreated (line 305) | @Override
method onActivityCreated (line 310) | @Override
method onResume (line 315) | @Override
method onPause (line 331) | @Override
method setCamera (line 338) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 345) | private void setUpCameraOutputs() {
method openCamera (line 388) | private void openCamera(final int width, final int height) {
method closeCamera (line 408) | private void closeCamera() {
method startBackgroundThread (line 433) | private void startBackgroundThread() {
method stopBackgroundThread (line 442) | private void stopBackgroundThread() {
method onCaptureProgressed (line 455) | @Override
method onCaptureCompleted (line 462) | @Override
method createCameraPreviewSession (line 473) | private void createCameraPreviewSession() {
method configureTransform (line 548) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 577) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 578) | @Override
class ErrorDialog (line 589) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 592) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 600) | @Override
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/MainActivity.java
class MainActivity (line 41) | public class MainActivity extends BaseCameraActivity implements ImageRea...
method onCreate (line 67) | @Override
method getLayoutId (line 78) | @Override
method onPreviewSizeChosen (line 83) | @Override
method startAnimation (line 173) | private void startAnimation() {
method animate (line 181) | private void animate(float from, float to) {
method showSpinner (line 200) | private void showSpinner() {
method hideSpinner (line 209) | private void hideSpinner() {
method showSnapshotLayout (line 218) | private void showSnapshotLayout() {
method showPreviewLayout (line 228) | private void showPreviewLayout() {
method onImageAvailable (line 233) | @Override
method getBitmapForAsset (line 255) | public static Bitmap getBitmapForAsset(Context context, String path) {
FILE: Android/AnimatedSkyApp/app/src/main/java/ai/fritz/animatedSky/OverlayView.java
class OverlayView (line 11) | public class OverlayView extends View {
method OverlayView (line 14) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 21) | public interface DrawCallback {
method drawCallback (line 22) | public void drawCallback(final Canvas canvas);
method setCallback (line 25) | public void setCallback(final DrawCallback callback) {
method draw (line 29) | @Override
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/BaseCameraActivity.java
class BaseCameraActivity (line 24) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 40) | @Override
method onStart (line 55) | @Override
method onResume (line 61) | @Override
method onPause (line 71) | @Override
method onStop (line 87) | @Override
method onDestroy (line 93) | @Override
method runInBackground (line 99) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 105) | @Override
method hasPermission (line 121) | private boolean hasPermission() {
method requestPermission (line 129) | private void requestPermission() {
method setFragment (line 138) | protected void setFragment() {
method chooseCamera (line 160) | private String chooseCamera() {
method isHardwareLevelSupported (line 196) | private boolean isHardwareLevelSupported(
method isDebug (line 207) | public boolean isDebug() {
method requestRender (line 211) | public void requestRender() {
method setCallback (line 218) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 225) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 228) | @Override
method onPreviewSizeChosen (line 239) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 241) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 243) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/CameraConnectionFragment.java
class CameraConnectionFragment (line 47) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 50) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 71) | @Override
method onSurfaceTextureSizeChanged (line 77) | @Override
method onSurfaceTextureDestroyed (line 83) | @Override
method onSurfaceTextureUpdated (line 88) | @Override
type ConnectionCallback (line 97) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 98) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 137) | @Override
method onDisconnected (line 145) | @Override
method onError (line 152) | @Override
method CameraConnectionFragment (line 212) | private CameraConnectionFragment(
method showToast (line 228) | private void showToast(final String text) {
method chooseOptimalSize (line 250) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 291) | public static CameraConnectionFragment newInstance(
method onCreateView (line 299) | @Override
method onViewCreated (line 305) | @Override
method onActivityCreated (line 310) | @Override
method onResume (line 315) | @Override
method onPause (line 331) | @Override
method setCamera (line 338) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 345) | private void setUpCameraOutputs() {
method openCamera (line 388) | private void openCamera(final int width, final int height) {
method closeCamera (line 408) | private void closeCamera() {
method startBackgroundThread (line 433) | private void startBackgroundThread() {
method stopBackgroundThread (line 442) | private void stopBackgroundThread() {
method onCaptureProgressed (line 455) | @Override
method onCaptureCompleted (line 462) | @Override
method createCameraPreviewSession (line 473) | private void createCameraPreviewSession() {
method configureTransform (line 549) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 578) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 579) | @Override
class ErrorDialog (line 590) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 593) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 601) | @Override
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/MainActivity.java
class MainActivity (line 43) | public class MainActivity extends BaseCameraActivity implements ImageRea...
method onCreate (line 64) | @Override
method onActivityResult (line 75) | @Override
method getLayoutId (line 117) | @Override
method onPreviewSizeChosen (line 122) | @Override
method showSpinner (line 224) | private void showSpinner() {
method hideSpinner (line 233) | private void hideSpinner() {
method showSnapshotLayout (line 242) | private void showSnapshotLayout() {
method showPreviewLayout (line 252) | private void showPreviewLayout() {
method onImageAvailable (line 257) | @Override
FILE: Android/BackgroundReplacementApp/app/src/main/java/ai/fritz/replaceBackground/OverlayView.java
class OverlayView (line 11) | public class OverlayView extends View {
method OverlayView (line 14) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 21) | public interface DrawCallback {
method drawCallback (line 22) | public void drawCallback(final Canvas canvas);
method setCallback (line 25) | public void setCallback(final DrawCallback callback) {
method draw (line 29) | @Override
FILE: Android/CameraBoilerplateApp/app/src/androidTest/java/ai/fritz/camera/ExampleInstrumentedTest.java
class ExampleInstrumentedTest (line 17) | @RunWith(AndroidJUnit4.class)
method useAppContext (line 19) | @Test
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/BaseCameraActivity.java
class BaseCameraActivity (line 24) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 39) | @Override
method onStart (line 54) | @Override
method onResume (line 60) | @Override
method onPause (line 70) | @Override
method onStop (line 91) | @Override
method onDestroy (line 97) | @Override
method runInBackground (line 103) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 109) | @Override
method hasPermission (line 124) | private boolean hasPermission() {
method requestPermission (line 133) | private void requestPermission() {
method setFragment (line 142) | protected void setFragment() {
method chooseCamera (line 164) | private String chooseCamera() {
method isHardwareLevelSupported (line 200) | private boolean isHardwareLevelSupported(
method isDebug (line 211) | public boolean isDebug() {
method requestRender (line 215) | public void requestRender() {
method setCallback (line 222) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 229) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 232) | @Override
method onPreviewSizeChosen (line 243) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 245) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 247) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/CameraConnectionFragment.java
class CameraConnectionFragment (line 48) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 51) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 72) | @Override
method onSurfaceTextureSizeChanged (line 78) | @Override
method onSurfaceTextureDestroyed (line 84) | @Override
method onSurfaceTextureUpdated (line 89) | @Override
type ConnectionCallback (line 98) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 99) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 138) | @Override
method onDisconnected (line 146) | @Override
method onError (line 153) | @Override
method CameraConnectionFragment (line 213) | private CameraConnectionFragment(
method showToast (line 229) | private void showToast(final String text) {
method chooseOptimalSize (line 251) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 292) | public static CameraConnectionFragment newInstance(
method onCreateView (line 300) | @Override
method onViewCreated (line 306) | @Override
method onActivityCreated (line 311) | @Override
method onResume (line 316) | @Override
method onPause (line 332) | @Override
method setCamera (line 339) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 346) | private void setUpCameraOutputs() {
method openCamera (line 389) | private void openCamera(final int width, final int height) {
method closeCamera (line 409) | private void closeCamera() {
method startBackgroundThread (line 434) | private void startBackgroundThread() {
method stopBackgroundThread (line 443) | private void stopBackgroundThread() {
method onCaptureProgressed (line 456) | @Override
method onCaptureCompleted (line 463) | @Override
method createCameraPreviewSession (line 474) | private void createCameraPreviewSession() {
method configureTransform (line 550) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 579) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 580) | @Override
class ErrorDialog (line 591) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 594) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 602) | @Override
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/LiveCameraActivity.java
class LiveCameraActivity (line 12) | public abstract class LiveCameraActivity extends BaseCameraActivity impl...
method onCreate (line 20) | @Override
method initializeFritz (line 27) | protected abstract void initializeFritz();
method setupPredictor (line 29) | protected abstract void setupPredictor();
method setupImageForPrediction (line 31) | protected abstract void setupImageForPrediction(Image image);
method runInference (line 33) | protected abstract void runInference();
method showResult (line 35) | protected abstract void showResult(Canvas canvas, Size cameraViewSize);
method getLayoutId (line 38) | @Override
method getDesiredPreviewFrameSize (line 43) | @Override
method onPreviewSizeChosen (line 48) | @Override
method onImageAvailable (line 61) | @Override
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/MainActivity.java
class MainActivity (line 8) | public class MainActivity extends LiveCameraActivity {
method initializeFritz (line 10) | @Override
method setupPredictor (line 16) | @Override
method setupImageForPrediction (line 27) | @Override
method runInference (line 36) | @Override
method showResult (line 45) | @Override
FILE: Android/CameraBoilerplateApp/app/src/main/java/ai/fritz/camera/OverlayView.java
class OverlayView (line 11) | public class OverlayView extends View {
method OverlayView (line 14) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 21) | public interface DrawCallback {
method drawCallback (line 22) | void drawCallback(final Canvas canvas);
method setCallback (line 25) | public void setCallback(final DrawCallback callback) {
method draw (line 29) | @Override
FILE: Android/CameraBoilerplateApp/app/src/test/java/ai/fritz/camera/ExampleUnitTest.java
class ExampleUnitTest (line 12) | public class ExampleUnitTest {
method addition_isCorrect (line 13) | @Test
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/Navigation.java
class Navigation (line 16) | public class Navigation {
method goToTFLite (line 18) | public static void goToTFLite(Context context) {
method goToLabelingActivity (line 23) | public static void goToLabelingActivity(Context context) {
method goToStyleTransfer (line 28) | public static void goToStyleTransfer(Context context) {
method goToImageSegmentation (line 33) | public static void goToImageSegmentation(Context context) {
method goToObjectDetection (line 38) | public static void goToObjectDetection(Context context) {
method goToPoseEstimation (line 43) | public static void goToPoseEstimation(Context context) {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/PredictorType.java
type PredictorType (line 3) | public enum PredictorType {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/BaseCameraActivity.java
class BaseCameraActivity (line 27) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 42) | @Override
method onStart (line 57) | @Override
method onResume (line 63) | @Override
method onPause (line 73) | @Override
method onStop (line 89) | @Override
method onDestroy (line 95) | @Override
method runInBackground (line 101) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 107) | @Override
method hasPermission (line 123) | private boolean hasPermission() {
method requestPermission (line 131) | private void requestPermission() {
method setFragment (line 140) | protected void setFragment() {
method chooseCamera (line 162) | private String chooseCamera() {
method isHardwareLevelSupported (line 198) | private boolean isHardwareLevelSupported(
method isDebug (line 209) | public boolean isDebug() {
method requestRender (line 213) | public void requestRender() {
method setCallback (line 220) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 227) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 230) | @Override
method onPreviewSizeChosen (line 241) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 243) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 245) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/BaseLiveVideoActivity.java
class BaseLiveVideoActivity (line 18) | public abstract class BaseLiveVideoActivity extends BaseCameraActivity i...
method onCreate (line 27) | @Override
method onPreviewSizeChosen (line 32) | @Override
method onImageAvailable (line 48) | @Override
method getLayoutId (line 74) | @Override
method onSetDebug (line 79) | @Override
method onCameraSetup (line 84) | protected abstract void onCameraSetup(Size cameraSize);
method handleDrawingResult (line 86) | protected abstract void handleDrawingResult(Canvas canvas, Size camera...
method runInference (line 88) | protected abstract void runInference(FritzVisionImage fritzVisionImage);
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/BaseRecordingActivity.java
class BaseRecordingActivity (line 36) | public abstract class BaseRecordingActivity extends BaseCameraActivity i...
method getModelOptionsTextId (line 66) | protected abstract int getModelOptionsTextId();
method runPrediction (line 68) | protected abstract Bitmap runPrediction(FritzVisionImage visionImage, ...
method loadPredictor (line 70) | protected abstract void loadPredictor(int choice);
method onCreate (line 73) | @Override
method getLayoutId (line 78) | @Override
method onPreviewSizeChosen (line 83) | @Override
method showPredictorReadyViews (line 177) | protected void showPredictorReadyViews() {
method showPredictorNotReadyViews (line 183) | protected void showPredictorNotReadyViews() {
method showStartRecordingViews (line 189) | private void showStartRecordingViews() {
method showCameraViews (line 215) | private void showCameraViews() {
method showFinishRecordingViews (line 224) | private void showFinishRecordingViews() {
method showStyleResults (line 234) | private void showStyleResults() {
method finishProcessing (line 240) | private void finishProcessing() {
method getModelText (line 267) | public String getModelText(int choice) {
method onImageAvailable (line 272) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/MainActivity.java
class MainActivity (line 30) | public class MainActivity extends AppCompatActivity {
method onCreate (line 42) | @Override
method getDemoItems (line 70) | private List<DemoItem> getDemoItems() {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/SplashActivity.java
class SplashActivity (line 12) | public class SplashActivity extends AppCompatActivity {
method onCreate (line 14) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/custommodel/CustomTFLiteActivity.java
class CustomTFLiteActivity (line 20) | public class CustomTFLiteActivity extends AppCompatActivity {
method onCreate (line 49) | @Override
method onResume (line 81) | @Override
method onPause (line 87) | @Override
method onDetectClicked (line 93) | private void onDetectClicked() {
method onClearClicked (line 103) | private void onClearClicked() {
class DrawOnTouchListener (line 113) | public class DrawOnTouchListener implements View.OnTouchListener {
method onTouch (line 114) | @Override
method processTouchDown (line 133) | private void processTouchDown(MotionEvent event) {
method processTouchMove (line 142) | private void processTouchMove(MotionEvent event) {
method processTouchUp (line 156) | private void processTouchUp() {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/custommodel/ml/Classifier.java
type Classifier (line 27) | public interface Classifier {
class Recognition (line 31) | public class Recognition {
method Recognition (line 53) | public Recognition(
method getId (line 61) | public String getId() {
method getTitle (line 65) | public String getTitle() {
method getConfidence (line 69) | public Float getConfidence() {
method getLocation (line 73) | public RectF getLocation() {
method setLocation (line 77) | public void setLocation(RectF location) {
method toString (line 81) | @Override
method recognizeImage (line 104) | List<Recognition> recognizeImage(Bitmap bitmap);
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/custommodel/ml/MnistClassifier.java
class MnistClassifier (line 19) | public class MnistClassifier {
method MnistClassifier (line 45) | public MnistClassifier(Activity activity) {
method runInference (line 71) | protected void runInference() {
method classify (line 84) | public int classify(Bitmap bitmap) {
method getResult (line 100) | private int getResult() {
method convertBitmapToByteBuffer (line 116) | private void convertBitmapToByteBuffer(Bitmap bitmap) {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/vision/ImageLabelingActivity.java
class ImageLabelingActivity (line 27) | public class ImageLabelingActivity extends BaseCameraActivity implements...
method onCreate (line 48) | @Override
method getLayoutId (line 55) | @Override
method getDesiredPreviewFrameSize (line 60) | @Override
method onPreviewSizeChosen (line 65) | @Override
method onImageAvailable (line 72) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/vision/ImageSegmentationActivity.java
class ImageSegmentationActivity (line 25) | public class ImageSegmentationActivity extends BaseRecordingActivity imp...
method onCreate (line 31) | @Override
method getModelOptionsTextId (line 38) | @Override
method runPrediction (line 43) | @Override
method loadPredictor (line 50) | @Override
method getManagedModel (line 71) | private SegmentationManagedModel getManagedModel(int choice) {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/vision/ObjectDetectionActivity.java
class ObjectDetectionActivity (line 17) | public class ObjectDetectionActivity extends BaseLiveVideoActivity {
method onCameraSetup (line 22) | @Override
method handleDrawingResult (line 28) | @Override
method runInference (line 38) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/vision/PoseEstimationActivity.java
class PoseEstimationActivity (line 20) | public class PoseEstimationActivity extends BaseLiveVideoActivity {
method onCameraSetup (line 26) | @Override
method handleDrawingResult (line 34) | @Override
method runInference (line 44) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/activities/vision/StyleTransferActivity.java
class StyleTransferActivity (line 19) | public class StyleTransferActivity extends BaseRecordingActivity impleme...
method onCreate (line 22) | @Override
method getModelOptionsTextId (line 27) | @Override
method runPrediction (line 32) | @Override
method loadPredictor (line 38) | @Override
method getModel (line 45) | private FritzOnDeviceModel getModel(int choice) {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/adapters/DemoAdapter.java
class DemoAdapter (line 18) | public class DemoAdapter extends RecyclerView.Adapter<DemoAdapter.ViewHo...
class ViewHolder (line 24) | public static class ViewHolder extends RecyclerView.ViewHolder {
method ViewHolder (line 29) | public ViewHolder(LinearLayout v) {
method DemoAdapter (line 42) | public DemoAdapter(List<DemoItem> demoItems) {
method onBindViewHolder (line 54) | @Override
method getItemCount (line 67) | @Override
method onCreateViewHolder (line 79) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/adapters/DemoItem.java
class DemoItem (line 8) | public class DemoItem {
method DemoItem (line 14) | public DemoItem(String title, String description, View.OnClickListener...
method getTitle (line 20) | public String getTitle() {
method setTitle (line 24) | public void setTitle(String title) {
method getDescription (line 28) | public String getDescription() {
method setDescription (line 32) | public void setDescription(String description) {
method getOnClickListener (line 36) | public View.OnClickListener getOnClickListener() {
method setOnClickListener (line 40) | public void setOnClickListener(View.OnClickListener onClickListener) {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/fragments/CameraConnectionFragment.java
class CameraConnectionFragment (line 49) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 52) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 73) | @Override
method onSurfaceTextureSizeChanged (line 79) | @Override
method onSurfaceTextureDestroyed (line 85) | @Override
method onSurfaceTextureUpdated (line 90) | @Override
type ConnectionCallback (line 99) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 100) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 139) | @Override
method onDisconnected (line 147) | @Override
method onError (line 154) | @Override
method CameraConnectionFragment (line 214) | private CameraConnectionFragment(
method showToast (line 230) | private void showToast(final String text) {
method chooseOptimalSize (line 252) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 293) | public static CameraConnectionFragment newInstance(
method onCreateView (line 301) | @Override
method onViewCreated (line 307) | @Override
method onActivityCreated (line 312) | @Override
method onResume (line 317) | @Override
method onPause (line 333) | @Override
method setCamera (line 340) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 347) | private void setUpCameraOutputs() {
method openCamera (line 390) | private void openCamera(final int width, final int height) {
method closeCamera (line 410) | private void closeCamera() {
method startBackgroundThread (line 435) | private void startBackgroundThread() {
method stopBackgroundThread (line 444) | private void stopBackgroundThread() {
method onCaptureProgressed (line 457) | @Override
method onCaptureCompleted (line 464) | @Override
method createCameraPreviewSession (line 475) | private void createCameraPreviewSession() {
method configureTransform (line 551) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 580) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 581) | @Override
class ErrorDialog (line 592) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 595) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 603) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/AutoFitTextureView.java
class AutoFitTextureView (line 25) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 29) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 33) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 37) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 49) | public void setAspectRatio(final int width, final int height) {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/ChooseModelDialog.java
class ChooseModelDialog (line 11) | public class ChooseModelDialog extends DialogFragment {
method ChooseModelDialog (line 19) | public ChooseModelDialog(int itemsResourceId, DialogInterface.OnClickL...
method onCreateDialog (line 24) | @Override
method getChoice (line 34) | public int getChoice() {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/DrawModel.java
class DrawModel (line 22) | public class DrawModel {
class LineElem (line 24) | public static class LineElem {
method LineElem (line 28) | private LineElem(float x, float y) {
class Line (line 34) | public static class Line {
method Line (line 37) | private Line() {
method addElem (line 40) | private void addElem(LineElem elem) {
method getElemSize (line 44) | public int getElemSize() {
method getElem (line 48) | public LineElem getElem(int index) {
method DrawModel (line 60) | public DrawModel(int width, int height) {
method getWidth (line 65) | public int getWidth() {
method getHeight (line 69) | public int getHeight() {
method startLine (line 73) | public void startLine(float x, float y) {
method endLine (line 79) | public void endLine() {
method addLineElem (line 83) | public void addLineElem(float x, float y) {
method getLineSize (line 89) | public int getLineSize() {
method getLine (line 93) | public Line getLine(int index) {
method clear (line 97) | public void clear() {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/DrawRenderer.java
class DrawRenderer (line 8) | public class DrawRenderer {
method renderModel (line 12) | public static void renderModel(Canvas canvas, DrawModel model, Paint p...
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/DrawView.java
class DrawView (line 30) | public class DrawView extends View {
method DrawView (line 44) | public DrawView(Context context, AttributeSet attrs) {
method setModel (line 48) | public void setModel(DrawModel model) {
method reset (line 52) | public void reset() {
method setup (line 62) | private void setup() {
method onDraw (line 92) | @Override
method calcPos (line 118) | public void calcPos(float x, float y, PointF out) {
method onResume (line 126) | public void onResume() {
method onPause (line 130) | public void onPause() {
method createBitmap (line 134) | private void createBitmap() {
method releaseBitmap (line 143) | private void releaseBitmap() {
method getDrawnBitmap (line 152) | public Bitmap getDrawnBitmap() {
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/OverlayView.java
class OverlayView (line 22) | public class OverlayView extends View {
method OverlayView (line 25) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 32) | public interface DrawCallback {
method drawCallback (line 33) | public void drawCallback(final Canvas canvas);
method setCallback (line 36) | public void setCallback(final DrawCallback callback) {
method draw (line 40) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/RecognitionScoreView.java
class RecognitionScoreView (line 16) | public class RecognitionScoreView extends View implements ResultsView {
method RecognitionScoreView (line 24) | public RecognitionScoreView(final Context context, final AttributeSet ...
method setResults (line 37) | @Override
method setResult (line 43) | @Override
method onDraw (line 49) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/ResultsView.java
type ResultsView (line 8) | public interface ResultsView {
method setResults (line 9) | void setResults(final List<Recognition> results);
method setResult (line 11) | void setResult(final List<FritzVisionLabel> labels);
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/ui/SeparatorDecoration.java
class SeparatorDecoration (line 17) | public class SeparatorDecoration extends RecyclerView.ItemDecoration {
method SeparatorDecoration (line 28) | public SeparatorDecoration(@NonNull Context context, @ColorInt int color,
method getItemOffsets (line 37) | @Override
method onDraw (line 52) | @Override
FILE: Android/FritzAIStudio/app/src/main/java/ai/fritz/aistudio/utils/VideoProcessingQueue.java
class VideoProcessingQueue (line 12) | public class VideoProcessingQueue {
type Listener (line 15) | public interface Listener {
method processVisionImage (line 16) | void processVisionImage(FritzVisionImage visionImage);
method finishedProcessing (line 18) | void finishedProcessing();
method VideoProcessingQueue (line 28) | public VideoProcessingQueue(Listener listener) {
method addVisionImage (line 36) | public void addVisionImage(FritzVisionImage visionImage) {
method getNumFramesToProcess (line 43) | public int getNumFramesToProcess() {
method runQueueProcessor (line 47) | private void runQueueProcessor() {
FILE: Android/FritzVisionVideoApp/app/src/androidTest/java/ai/fritz/fritzvisionvideo/ExampleInstrumentedTest.java
class ExampleInstrumentedTest (line 18) | @RunWith(AndroidJUnit4.class)
method useAppContext (line 20) | @Test
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/MainActivity.java
class MainActivity (line 25) | public class MainActivity extends AppCompatActivity {
method onCreate (line 29) | @Override
method getDemoItems (line 50) | private List<DemoItem> getDemoItems() {
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/VideoActivity.java
class VideoActivity (line 32) | public class VideoActivity extends AppCompatActivity {
method onCreate (line 45) | @Override
method onCreateOptionsMenu (line 70) | @Override
method onDestroy (line 91) | @Override
method onActivityResult (line 106) | @Override
method startProcessing (line 122) | private void startProcessing(Uri videoUri) {
method updateProgress (line 167) | private void updateProgress(final int progress) {
method displayVideo (line 180) | private void displayVideo(final Uri videoUri) {
method saveProcessedVideo (line 197) | private void saveProcessedVideo() throws IOException {
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/MaskCutStrategy.java
class MaskCutStrategy (line 16) | public class MaskCutStrategy extends VideoFilterStrategy {
method MaskCutStrategy (line 21) | public MaskCutStrategy() {
method MaskCutStrategy (line 25) | public MaskCutStrategy(Parcel in) {
method createFromParcel (line 30) | @Override
method newArray (line 35) | @Override
method getFilters (line 41) | @Override
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/ObjectPoseStrategy.java
class ObjectPoseStrategy (line 16) | public class ObjectPoseStrategy extends VideoFilterStrategy {
method ObjectPoseStrategy (line 22) | public ObjectPoseStrategy() {
method ObjectPoseStrategy (line 26) | public ObjectPoseStrategy(Parcel in) {
method createFromParcel (line 31) | @Override
method newArray (line 36) | @Override
method getFilters (line 42) | @Override
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/PoseDoubleMaskStrategy.java
class PoseDoubleMaskStrategy (line 18) | public class PoseDoubleMaskStrategy extends VideoFilterStrategy {
method PoseDoubleMaskStrategy (line 26) | public PoseDoubleMaskStrategy() {
method PoseDoubleMaskStrategy (line 30) | public PoseDoubleMaskStrategy(Parcel in) {
method createFromParcel (line 35) | @Override
method newArray (line 40) | @Override
method getFilters (line 46) | @Override
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/StylizeBackgroundStrategy.java
class StylizeBackgroundStrategy (line 17) | public class StylizeBackgroundStrategy extends VideoFilterStrategy {
method StylizeBackgroundStrategy (line 22) | public StylizeBackgroundStrategy() {
method StylizeBackgroundStrategy (line 26) | public StylizeBackgroundStrategy(Parcel in) {
method createFromParcel (line 31) | @Override
method newArray (line 36) | @Override
method getFilters (line 42) | @Override
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/StylizeHairStrategy.java
class StylizeHairStrategy (line 16) | public class StylizeHairStrategy extends VideoFilterStrategy {
method StylizeHairStrategy (line 21) | public StylizeHairStrategy() {
method StylizeHairStrategy (line 25) | public StylizeHairStrategy(Parcel in) {
method createFromParcel (line 30) | @Override
method newArray (line 35) | @Override
method getFilters (line 41) | @Override
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/VideoFilterStrategy.java
class VideoFilterStrategy (line 8) | public abstract class VideoFilterStrategy implements Parcelable {
method VideoFilterStrategy (line 10) | protected VideoFilterStrategy() {
method VideoFilterStrategy (line 13) | protected VideoFilterStrategy(Parcel in) {
method writeToParcel (line 16) | @Override
method describeContents (line 20) | @Override
method getFilters (line 30) | public abstract FritzVisionImageFilter[] getFilters();
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/customfilters/StylizeHairFilter.java
class StylizeHairFilter (line 14) | public class StylizeHairFilter extends FritzVisionSegmentationFilter {
method StylizeHairFilter (line 18) | public StylizeHairFilter(
method StylizeHairFilter (line 27) | public StylizeHairFilter(
method getCompositionMode (line 37) | @Override
method processImage (line 42) | @Override
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/ui/DemoAdapter.java
class DemoAdapter (line 18) | public class DemoAdapter extends RecyclerView.Adapter<DemoAdapter.ViewHo...
class ViewHolder (line 24) | public static class ViewHolder extends RecyclerView.ViewHolder {
method ViewHolder (line 29) | public ViewHolder(LinearLayout v) {
method DemoAdapter (line 42) | public DemoAdapter(List<DemoItem> demoItems) {
method onBindViewHolder (line 54) | @Override
method getItemCount (line 67) | @Override
method onCreateViewHolder (line 79) | @Override
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/ui/DemoItem.java
class DemoItem (line 8) | public class DemoItem {
method DemoItem (line 14) | public DemoItem(String title, String description, View.OnClickListener...
method getTitle (line 20) | public String getTitle() {
method setTitle (line 24) | public void setTitle(String title) {
method getDescription (line 28) | public String getDescription() {
method setDescription (line 32) | public void setDescription(String description) {
method getOnClickListener (line 36) | public View.OnClickListener getOnClickListener() {
method setOnClickListener (line 40) | public void setOnClickListener(View.OnClickListener onClickListener) {
FILE: Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/ui/SeparatorDecoration.java
class SeparatorDecoration (line 19) | public class SeparatorDecoration extends RecyclerView.ItemDecoration {
method SeparatorDecoration (line 30) | public SeparatorDecoration(@NonNull Context context, @ColorInt int color,
method getItemOffsets (line 39) | @Override
method onDraw (line 54) | @Override
FILE: Android/FritzVisionVideoApp/app/src/test/java/ai/fritz/fritzvisionvideo/ExampleUnitTest.java
class ExampleUnitTest (line 12) | public class ExampleUnitTest {
method addition_isCorrect (line 13) | @Test
FILE: Android/HairColoringApp/app/src/androidTest/java/ai/fritz/haircoloring/ExampleInstrumentedTest.java
class ExampleInstrumentedTest (line 17) | @RunWith(AndroidJUnit4.class)
method useAppContext (line 19) | @Test
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/activities/BaseCameraActivity.java
class BaseCameraActivity (line 29) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 47) | @Override
method onStart (line 62) | @Override
method onResume (line 68) | @Override
method onPause (line 78) | @Override
method onStop (line 94) | @Override
method onDestroy (line 100) | @Override
method getCameraFacingDirection (line 106) | protected int getCameraFacingDirection() {
method setCameraFacingDirection (line 110) | protected void setCameraFacingDirection(int cameraFacingDirection) {
method runInBackground (line 114) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 120) | @Override
method hasPermission (line 136) | private boolean hasPermission() {
method requestPermission (line 144) | private void requestPermission() {
method setFragment (line 153) | protected void setFragment() {
method toggleCameraFacingDirection (line 197) | protected void toggleCameraFacingDirection() {
method chooseCamera (line 213) | private String chooseCamera() {
method isHardwareLevelSupported (line 249) | private boolean isHardwareLevelSupported(
method isDebug (line 260) | public boolean isDebug() {
method requestRender (line 264) | public void requestRender() {
method setCallback (line 271) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 278) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 281) | @Override
method onPreviewSizeChosen (line 292) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 294) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 296) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/activities/BaseLiveGPUActivity.java
class BaseLiveGPUActivity (line 19) | public abstract class BaseLiveGPUActivity extends BaseCameraActivity imp...
method onCreate (line 30) | @Override
method onPreviewSizeChosen (line 35) | @Override
method onImageAvailable (line 51) | @Override
method getLayoutId (line 69) | protected abstract int getLayoutId();
method onSetDebug (line 71) | @Override
method runInference (line 76) | protected abstract void runInference(FritzVisionImage fritzVisionImage);
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/activities/LiveHairColorActivity.java
class LiveHairColorActivity (line 24) | public class LiveHairColorActivity extends BaseLiveGPUActivity {
method onCreate (line 36) | public void onCreate(final Bundle savedInstanceState) {
method onPreviewSizeChosen (line 53) | @Override
method getLayoutId (line 70) | @Override
method runInference (line 75) | @Override
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/activities/MainActivity.java
class MainActivity (line 21) | public class MainActivity extends AppCompatActivity {
method onCreate (line 25) | @Override
method getDemoItems (line 46) | private List<DemoItem> getDemoItems() {
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/activities/VideoHairColorActivity.java
class VideoHairColorActivity (line 42) | public class VideoHairColorActivity extends AppCompatActivity {
method onCreate (line 58) | @Override
method onCreateOptionsMenu (line 93) | @Override
method onDestroy (line 114) | @Override
method onActivityResult (line 129) | @Override
method startProcessing (line 145) | private void startProcessing(Uri videoUri) {
method updateProgress (line 195) | private void updateProgress(final int progress) {
method displayVideo (line 208) | private void displayVideo(final Uri videoUri) {
method saveProcessedVideo (line 225) | private void saveProcessedVideo() throws IOException {
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/ui/DemoAdapter.java
class DemoAdapter (line 18) | public class DemoAdapter extends RecyclerView.Adapter<DemoAdapter.ViewHo...
class ViewHolder (line 24) | public static class ViewHolder extends RecyclerView.ViewHolder {
method ViewHolder (line 29) | public ViewHolder(LinearLayout v) {
method DemoAdapter (line 42) | public DemoAdapter(List<DemoItem> demoItems) {
method onBindViewHolder (line 54) | @Override
method getItemCount (line 67) | @Override
method onCreateViewHolder (line 79) | @Override
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/ui/DemoItem.java
class DemoItem (line 8) | public class DemoItem {
method DemoItem (line 14) | public DemoItem(String title, String description, View.OnClickListener...
method getTitle (line 20) | public String getTitle() {
method setTitle (line 24) | public void setTitle(String title) {
method getDescription (line 28) | public String getDescription() {
method setDescription (line 32) | public void setDescription(String description) {
method getOnClickListener (line 36) | public View.OnClickListener getOnClickListener() {
method setOnClickListener (line 40) | public void setOnClickListener(View.OnClickListener onClickListener) {
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/ui/SeparatorDecoration.java
class SeparatorDecoration (line 19) | public class SeparatorDecoration extends RecyclerView.ItemDecoration {
method SeparatorDecoration (line 30) | public SeparatorDecoration(@NonNull Context context, @ColorInt int color,
method getItemOffsets (line 39) | @Override
method onDraw (line 54) | @Override
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/views/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/views/CameraConnectionFragment.java
class CameraConnectionFragment (line 49) | public class CameraConnectionFragment extends Fragment {
type CameraOpenListener (line 52) | public interface CameraOpenListener {
method onCameraOpened (line 53) | void onCameraOpened();
method CameraConnectionFragment (line 56) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 77) | @Override
method onSurfaceTextureSizeChanged (line 83) | @Override
method onSurfaceTextureDestroyed (line 89) | @Override
method onSurfaceTextureUpdated (line 94) | @Override
type ConnectionCallback (line 103) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 104) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method CameraConnectionFragment (line 192) | private CameraConnectionFragment(
method showToast (line 239) | private void showToast(final String text) {
method chooseOptimalSize (line 261) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 302) | public static CameraConnectionFragment newInstance(
method onCreateView (line 311) | @Override
method onViewCreated (line 317) | @Override
method onActivityCreated (line 322) | @Override
method onResume (line 327) | @Override
method onPause (line 343) | @Override
method setCamera (line 350) | public void setCamera(String cameraId) {
method switchCamera (line 354) | public void switchCamera(String cameraId) {
method setUpCameraOutputs (line 363) | private void setUpCameraOutputs() {
method openCamera (line 406) | private void openCamera(final int width, final int height) {
method closeCamera (line 426) | private void closeCamera() {
method startBackgroundThread (line 451) | private void startBackgroundThread() {
method stopBackgroundThread (line 460) | private void stopBackgroundThread() {
method onCaptureProgressed (line 473) | @Override
method onCaptureCompleted (line 480) | @Override
method createCameraPreviewSession (line 491) | private void createCameraPreviewSession() {
method configureTransform (line 567) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 596) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 597) | @Override
class ErrorDialog (line 608) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 611) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 619) | @Override
FILE: Android/HairColoringApp/app/src/main/java/ai/fritz/haircoloring/views/OverlayView.java
class OverlayView (line 22) | public class OverlayView extends View {
method OverlayView (line 25) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 32) | public interface DrawCallback {
method drawCallback (line 33) | void drawCallback(final Canvas canvas);
method setCallback (line 36) | public void setCallback(final DrawCallback callback) {
method draw (line 40) | @Override
FILE: Android/HairColoringApp/app/src/test/java/ai/fritz/haircoloring/ExampleUnitTest.java
class ExampleUnitTest (line 12) | public class ExampleUnitTest {
method addition_isCorrect (line 13) | @Test
FILE: Android/ImageLabelingApp/app/src/main/java/ai/fritz/camera/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/ImageLabelingApp/app/src/main/java/ai/fritz/camera/BaseCameraActivity.java
class BaseCameraActivity (line 26) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 41) | @Override
method onStart (line 56) | @Override
method onResume (line 62) | @Override
method onPause (line 72) | @Override
method onStop (line 93) | @Override
method onDestroy (line 99) | @Override
method runInBackground (line 105) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 111) | @Override
method hasPermission (line 126) | private boolean hasPermission() {
method requestPermission (line 135) | private void requestPermission() {
method setFragment (line 144) | protected void setFragment() {
method chooseCamera (line 166) | private String chooseCamera() {
method isHardwareLevelSupported (line 202) | private boolean isHardwareLevelSupported(
method isDebug (line 213) | public boolean isDebug() {
method requestRender (line 217) | public void requestRender() {
method setCallback (line 224) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 231) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 234) | @Override
method onPreviewSizeChosen (line 245) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 247) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 249) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/ImageLabelingApp/app/src/main/java/ai/fritz/camera/CameraConnectionFragment.java
class CameraConnectionFragment (line 49) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 52) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 73) | @Override
method onSurfaceTextureSizeChanged (line 79) | @Override
method onSurfaceTextureDestroyed (line 85) | @Override
method onSurfaceTextureUpdated (line 90) | @Override
type ConnectionCallback (line 99) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 100) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 139) | @Override
method onDisconnected (line 147) | @Override
method onError (line 154) | @Override
method CameraConnectionFragment (line 214) | private CameraConnectionFragment(
method showToast (line 230) | private void showToast(final String text) {
method chooseOptimalSize (line 252) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 293) | public static CameraConnectionFragment newInstance(
method onCreateView (line 301) | @Override
method onViewCreated (line 307) | @Override
method onActivityCreated (line 312) | @Override
method onResume (line 317) | @Override
method onPause (line 333) | @Override
method setCamera (line 340) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 347) | private void setUpCameraOutputs() {
method openCamera (line 390) | private void openCamera(final int width, final int height) {
method closeCamera (line 410) | private void closeCamera() {
method startBackgroundThread (line 435) | private void startBackgroundThread() {
method stopBackgroundThread (line 444) | private void stopBackgroundThread() {
method onCaptureProgressed (line 457) | @Override
method onCaptureCompleted (line 464) | @Override
method createCameraPreviewSession (line 475) | private void createCameraPreviewSession() {
method configureTransform (line 551) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 580) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 581) | @Override
class ErrorDialog (line 592) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 595) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 603) | @Override
FILE: Android/ImageLabelingApp/app/src/main/java/ai/fritz/camera/MainActivity.java
class MainActivity (line 33) | public class MainActivity extends BaseCameraActivity implements ImageRea...
method onCreate (line 58) | @Override
method getLayoutId (line 71) | @Override
method getDesiredPreviewFrameSize (line 76) | @Override
method onPreviewSizeChosen (line 81) | @Override
method switchToSnapshotView (line 152) | private void switchToSnapshotView() {
method switchPreviewView (line 162) | private void switchPreviewView() {
method showSpinner (line 174) | private void showSpinner() {
method hideSpinner (line 183) | private void hideSpinner() {
method onImageAvailable (line 192) | @Override
FILE: Android/ImageLabelingApp/app/src/main/java/ai/fritz/camera/OverlayView.java
class OverlayView (line 22) | public class OverlayView extends View {
method OverlayView (line 31) | public OverlayView(final Context context, final AttributeSet attrs) {
method setResult (line 45) | public void setResult(final List<FritzVisionLabel> labels) {
type DrawCallback (line 52) | public interface DrawCallback {
method drawCallback (line 53) | void drawCallback(final Canvas canvas);
method setCallback (line 56) | public void setCallback(final DrawCallback callback) {
method draw (line 60) | @Override
FILE: Android/ObjectDetectionApp/app/src/main/java/ai/fritz/camera/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/ObjectDetectionApp/app/src/main/java/ai/fritz/camera/BaseCameraActivity.java
class BaseCameraActivity (line 26) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 41) | @Override
method onStart (line 56) | @Override
method onResume (line 62) | @Override
method onPause (line 72) | @Override
method onStop (line 93) | @Override
method onDestroy (line 99) | @Override
method runInBackground (line 105) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 111) | @Override
method hasPermission (line 126) | private boolean hasPermission() {
method requestPermission (line 135) | private void requestPermission() {
method setFragment (line 144) | protected void setFragment() {
method chooseCamera (line 166) | private String chooseCamera() {
method isHardwareLevelSupported (line 202) | private boolean isHardwareLevelSupported(
method isDebug (line 213) | public boolean isDebug() {
method requestRender (line 217) | public void requestRender() {
method setCallback (line 224) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 231) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 234) | @Override
method onPreviewSizeChosen (line 245) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 247) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 249) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/ObjectDetectionApp/app/src/main/java/ai/fritz/camera/CameraConnectionFragment.java
class CameraConnectionFragment (line 49) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 52) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 73) | @Override
method onSurfaceTextureSizeChanged (line 79) | @Override
method onSurfaceTextureDestroyed (line 85) | @Override
method onSurfaceTextureUpdated (line 90) | @Override
type ConnectionCallback (line 99) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 100) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 139) | @Override
method onDisconnected (line 147) | @Override
method onError (line 154) | @Override
method CameraConnectionFragment (line 214) | private CameraConnectionFragment(
method showToast (line 230) | private void showToast(final String text) {
method chooseOptimalSize (line 252) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 293) | public static CameraConnectionFragment newInstance(
method onCreateView (line 301) | @Override
method onViewCreated (line 307) | @Override
method onActivityCreated (line 312) | @Override
method onResume (line 317) | @Override
method onPause (line 333) | @Override
method setCamera (line 340) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 347) | private void setUpCameraOutputs() {
method openCamera (line 390) | private void openCamera(final int width, final int height) {
method closeCamera (line 410) | private void closeCamera() {
method startBackgroundThread (line 435) | private void startBackgroundThread() {
method stopBackgroundThread (line 444) | private void stopBackgroundThread() {
method onCaptureProgressed (line 457) | @Override
method onCaptureCompleted (line 464) | @Override
method createCameraPreviewSession (line 475) | private void createCameraPreviewSession() {
method configureTransform (line 551) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 580) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 581) | @Override
class ErrorDialog (line 592) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 595) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 603) | @Override
FILE: Android/ObjectDetectionApp/app/src/main/java/ai/fritz/camera/MainActivity.java
class MainActivity (line 29) | public class MainActivity extends BaseCameraActivity implements ImageRea...
method onCreate (line 54) | @Override
method getLayoutId (line 65) | @Override
method getDesiredPreviewFrameSize (line 70) | @Override
method onPreviewSizeChosen (line 75) | @Override
method switchToSnapshotView (line 148) | private void switchToSnapshotView() {
method switchPreviewView (line 158) | private void switchPreviewView() {
method showSpinner (line 170) | private void showSpinner() {
method hideSpinner (line 179) | private void hideSpinner() {
method onImageAvailable (line 188) | @Override
FILE: Android/ObjectDetectionApp/app/src/main/java/ai/fritz/camera/OverlayView.java
class OverlayView (line 11) | public class OverlayView extends View {
method OverlayView (line 14) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 21) | public interface DrawCallback {
method drawCallback (line 22) | void drawCallback(final Canvas canvas);
method setCallback (line 25) | public void setCallback(final DrawCallback callback) {
method draw (line 29) | @Override
FILE: Android/PetMonitoringApp/app/src/main/java/ai/fritz/petdetector/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/PetMonitoringApp/app/src/main/java/ai/fritz/petdetector/BaseCameraActivity.java
class BaseCameraActivity (line 23) | public abstract class BaseCameraActivity extends Activity implements OnI...
method onCreate (line 39) | @Override
method onStart (line 54) | @Override
method onResume (line 60) | @Override
method onPause (line 70) | @Override
method onStop (line 91) | @Override
method onDestroy (line 97) | @Override
method runInBackground (line 103) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 109) | @Override
method hasPermission (line 125) | private boolean hasPermission() {
method requestPermission (line 133) | private void requestPermission() {
method setFragment (line 142) | protected void setFragment() {
method chooseCamera (line 164) | private String chooseCamera() {
method isHardwareLevelSupported (line 200) | private boolean isHardwareLevelSupported(
method isDebug (line 211) | public boolean isDebug() {
method requestRender (line 215) | public void requestRender() {
method addCallback (line 222) | public void addCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 229) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 232) | @Override
method onPreviewSizeChosen (line 243) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 245) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 247) | protected abstract Size getDesiredPreviewFrameSize();
FILE: Android/PetMonitoringApp/app/src/main/java/ai/fritz/petdetector/CameraConnectionFragment.java
class CameraConnectionFragment (line 47) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 50) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 71) | @Override
method onSurfaceTextureSizeChanged (line 77) | @Override
method onSurfaceTextureDestroyed (line 83) | @Override
method onSurfaceTextureUpdated (line 88) | @Override
type ConnectionCallback (line 97) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 98) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 137) | @Override
method onDisconnected (line 145) | @Override
method onError (line 152) | @Override
method CameraConnectionFragment (line 212) | private CameraConnectionFragment(
method showToast (line 228) | private void showToast(final String text) {
method chooseOptimalSize (line 250) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 291) | public static CameraConnectionFragment newInstance(
method onCreateView (line 299) | @Override
method onViewCreated (line 305) | @Override
method onActivityCreated (line 310) | @Override
method onResume (line 315) | @Override
method onPause (line 331) | @Override
method setCamera (line 338) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 345) | private void setUpCameraOutputs() {
method openCamera (line 388) | private void openCamera(final int width, final int height) {
method closeCamera (line 408) | private void closeCamera() {
method startBackgroundThread (line 433) | private void startBackgroundThread() {
method stopBackgroundThread (line 442) | private void stopBackgroundThread() {
method onCaptureProgressed (line 455) | @Override
method onCaptureCompleted (line 462) | @Override
method createCameraPreviewSession (line 473) | private void createCameraPreviewSession() {
method configureTransform (line 549) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 578) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 579) | @Override
class ErrorDialog (line 590) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 593) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 601) | @Override
FILE: Android/PetMonitoringApp/app/src/main/java/ai/fritz/petdetector/MainActivity.java
class MainActivity (line 27) | public class MainActivity extends BaseCameraActivity implements ImageRea...
method onCreate (line 45) | @Override
method getLayoutId (line 64) | @Override
method getDesiredPreviewFrameSize (line 69) | @Override
method onPreviewSizeChosen (line 74) | @Override
method onImageAvailable (line 131) | @Override
FILE: Android/PetMonitoringApp/app/src/main/java/ai/fritz/petdetector/OverlayView.java
class OverlayView (line 14) | public class OverlayView extends View {
method OverlayView (line 17) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 24) | public interface DrawCallback {
method drawCallback (line 25) | public void drawCallback(final Canvas canvas);
method addCallback (line 28) | public void addCallback(final DrawCallback callback) {
method draw (line 32) | @Override
FILE: Android/PetStickerApp/app/src/main/java/ai/fritz/petSticker/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/PetStickerApp/app/src/main/java/ai/fritz/petSticker/BaseCameraActivity.java
class BaseCameraActivity (line 24) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 40) | @Override
method onStart (line 55) | @Override
method onResume (line 61) | @Override
method onPause (line 71) | @Override
method onStop (line 87) | @Override
method onDestroy (line 93) | @Override
method runInBackground (line 99) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 105) | @Override
method hasPermission (line 121) | private boolean hasPermission() {
method requestPermission (line 129) | private void requestPermission() {
method setFragment (line 138) | protected void setFragment() {
method chooseCamera (line 160) | private String chooseCamera() {
method isHardwareLevelSupported (line 196) | private boolean isHardwareLevelSupported(
method isDebug (line 207) | public boolean isDebug() {
method requestRender (line 211) | public void requestRender() {
method setCallback (line 218) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 225) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 228) | @Override
method onPreviewSizeChosen (line 239) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 241) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 243) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/PetStickerApp/app/src/main/java/ai/fritz/petSticker/CameraConnectionFragment.java
class CameraConnectionFragment (line 47) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 50) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 71) | @Override
method onSurfaceTextureSizeChanged (line 77) | @Override
method onSurfaceTextureDestroyed (line 83) | @Override
method onSurfaceTextureUpdated (line 88) | @Override
type ConnectionCallback (line 97) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 98) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 137) | @Override
method onDisconnected (line 145) | @Override
method onError (line 152) | @Override
method CameraConnectionFragment (line 212) | private CameraConnectionFragment(
method showToast (line 228) | private void showToast(final String text) {
method chooseOptimalSize (line 250) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 291) | public static CameraConnectionFragment newInstance(
method onCreateView (line 299) | @Override
method onViewCreated (line 305) | @Override
method onActivityCreated (line 310) | @Override
method onResume (line 315) | @Override
method onPause (line 331) | @Override
method setCamera (line 338) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 345) | private void setUpCameraOutputs() {
method openCamera (line 388) | private void openCamera(final int width, final int height) {
method closeCamera (line 408) | private void closeCamera() {
method startBackgroundThread (line 433) | private void startBackgroundThread() {
method stopBackgroundThread (line 442) | private void stopBackgroundThread() {
method onCaptureProgressed (line 455) | @Override
method onCaptureCompleted (line 462) | @Override
method createCameraPreviewSession (line 473) | private void createCameraPreviewSession() {
method configureTransform (line 549) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 578) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 579) | @Override
class ErrorDialog (line 590) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 593) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 601) | @Override
FILE: Android/PetStickerApp/app/src/main/java/ai/fritz/petSticker/MainActivity.java
class MainActivity (line 37) | public class MainActivity extends BaseCameraActivity implements ImageRea...
method onCreate (line 58) | @Override
method getLayoutId (line 69) | @Override
method onPreviewSizeChosen (line 74) | @Override
method showSpinner (line 170) | private void showSpinner() {
method hideSpinner (line 179) | private void hideSpinner() {
method showSnapshotLayout (line 188) | private void showSnapshotLayout() {
method showPreviewLayout (line 199) | private void showPreviewLayout() {
method onImageAvailable (line 204) | @Override
FILE: Android/PetStickerApp/app/src/main/java/ai/fritz/petSticker/OverlayView.java
class OverlayView (line 11) | public class OverlayView extends View {
method OverlayView (line 14) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 21) | public interface DrawCallback {
method drawCallback (line 22) | public void drawCallback(final Canvas canvas);
method setCallback (line 25) | public void setCallback(final DrawCallback callback) {
method draw (line 29) | @Override
FILE: Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/AutoFitTextureView.java
class AutoFitTextureView (line 10) | public class AutoFitTextureView extends TextureView {
method AutoFitTextureView (line 14) | public AutoFitTextureView(final Context context) {
method AutoFitTextureView (line 18) | public AutoFitTextureView(final Context context, final AttributeSet at...
method AutoFitTextureView (line 22) | public AutoFitTextureView(final Context context, final AttributeSet at...
method setAspectRatio (line 34) | public void setAspectRatio(final int width, final int height) {
FILE: Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/BaseCameraActivity.java
class BaseCameraActivity (line 26) | public abstract class BaseCameraActivity extends AppCompatActivity imple...
method onCreate (line 41) | @Override
method onStart (line 56) | @Override
method onResume (line 62) | @Override
method onPause (line 72) | @Override
method onStop (line 93) | @Override
method onDestroy (line 99) | @Override
method runInBackground (line 105) | protected synchronized void runInBackground(final Runnable r) {
method onRequestPermissionsResult (line 111) | @Override
method hasPermission (line 126) | private boolean hasPermission() {
method requestPermission (line 135) | private void requestPermission() {
method setFragment (line 144) | protected void setFragment() {
method chooseCamera (line 166) | private String chooseCamera() {
method isHardwareLevelSupported (line 202) | private boolean isHardwareLevelSupported(
method isDebug (line 213) | public boolean isDebug() {
method requestRender (line 217) | public void requestRender() {
method setCallback (line 224) | public void setCallback(final OverlayView.DrawCallback callback) {
method onSetDebug (line 231) | public void onSetDebug(final boolean debug) {
method onKeyDown (line 234) | @Override
method onPreviewSizeChosen (line 245) | protected abstract void onPreviewSizeChosen(final Size previewSize, fi...
method getLayoutId (line 247) | protected abstract int getLayoutId();
method getDesiredPreviewFrameSize (line 249) | protected Size getDesiredPreviewFrameSize() {
FILE: Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/CameraConnectionFragment.java
class CameraConnectionFragment (line 49) | public class CameraConnectionFragment extends Fragment {
method CameraConnectionFragment (line 52) | public CameraConnectionFragment() {
method onSurfaceTextureAvailable (line 73) | @Override
method onSurfaceTextureSizeChanged (line 79) | @Override
method onSurfaceTextureDestroyed (line 85) | @Override
method onSurfaceTextureUpdated (line 90) | @Override
type ConnectionCallback (line 99) | public interface ConnectionCallback {
method onPreviewSizeChosen (line 100) | void onPreviewSizeChosen(Size size, Size cameraViewSize, int cameraR...
method onOpened (line 139) | @Override
method onDisconnected (line 147) | @Override
method onError (line 154) | @Override
method CameraConnectionFragment (line 214) | private CameraConnectionFragment(
method showToast (line 230) | private void showToast(final String text) {
method chooseOptimalSize (line 252) | protected static Size chooseOptimalSize(final Size[] choices, final in...
method newInstance (line 293) | public static CameraConnectionFragment newInstance(
method onCreateView (line 301) | @Override
method onViewCreated (line 307) | @Override
method onActivityCreated (line 312) | @Override
method onResume (line 317) | @Override
method onPause (line 333) | @Override
method setCamera (line 340) | public void setCamera(String cameraId) {
method setUpCameraOutputs (line 347) | private void setUpCameraOutputs() {
method openCamera (line 390) | private void openCamera(final int width, final int height) {
method closeCamera (line 410) | private void closeCamera() {
method startBackgroundThread (line 435) | private void startBackgroundThread() {
method stopBackgroundThread (line 444) | private void stopBackgroundThread() {
method onCaptureProgressed (line 457) | @Override
method onCaptureCompleted (line 464) | @Override
method createCameraPreviewSession (line 475) | private void createCameraPreviewSession() {
method configureTransform (line 551) | private void configureTransform(final int viewWidth, final int viewHei...
class CompareSizesByArea (line 580) | static class CompareSizesByArea implements Comparator<Size> {
method compare (line 581) | @Override
class ErrorDialog (line 592) | public static class ErrorDialog extends DialogFragment {
method newInstance (line 595) | public static ErrorDialog newInstance(final String message) {
method onCreateDialog (line 603) | @Override
FILE: Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/MainActivity.java
class MainActivity (line 31) | public class MainActivity extends BaseCameraActivity implements ImageRea...
method onCreate (line 56) | @Override
method getLayoutId (line 67) | @Override
method getDesiredPreviewFrameSize (line 72) | @Override
method onPreviewSizeChosen (line 77) | @Override
method switchToSnapshotView (line 150) | private void switchToSnapshotView() {
method switchPreviewView (line 160) | private void switchPreviewView() {
method showSpinner (line 172) | private void showSpinner() {
method hideSpinner (line 181) | private void hideSpinner() {
method onImageAvailable (line 190) | @Override
FILE: Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/OverlayView.java
class OverlayView (line 11) | public class OverlayView extends View {
method OverlayView (line 14) | public OverlayView(final Context context, final AttributeSet attrs) {
type DrawCallback (line 21) | public interface DrawCallback {
method drawCallback (line 22) | void drawCallback(final Canvas canvas);
method setCallback (line 25) | public void setCallback(final DrawCallback callback) {
method draw (line 29) | @Override
Condensed preview — 701 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,123K chars).
[
{
"path": ".gitattributes",
"chars": 42,
"preview": "*.zip filter=lfs diff=lfs merge=lfs -text\n"
},
{
"path": ".gitignore",
"chars": 800,
"preview": "#### CocoaPods\nPods/\n*.generated.swift\n\n#### Fastlane\nfastlane/report.xml\nfastlane/README.md\n\n#### macOS\n.DS_Store\n\n####"
},
{
"path": ".swiftlint.yml",
"chars": 251,
"preview": "included:\n - Heartbeat/Source\nexcluded:\n - Pods\n - Supporting Files\nopt_in_rules:\n - attributes\n - closure_end_inde"
},
{
"path": "Android/.gitignore",
"chars": 697,
"preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the ART/Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated file"
},
{
"path": "Android/AnimatedSkyApp/.gitignore",
"chars": 877,
"preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the ART/Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated file"
},
{
"path": "Android/AnimatedSkyApp/README.md",
"chars": 3538,
"preview": "# Animations with Sky Segmentation\n\n[ ;"
},
{
"path": "Android/AnimatedSkyApp/app/src/main/res/values/fritz.xml",
"chars": 80,
"preview": "<resources>\n <string name=\"fritz_api_key\">Your API Key</string>\n</resources>\n"
},
{
"path": "Android/AnimatedSkyApp/app/src/main/res/values/strings.xml",
"chars": 159,
"preview": "<resources>\n <string name=\"app_name\">Sky Animation</string>\n <string name=\"camera_error\">This device doesn\\'t supp"
},
{
"path": "Android/AnimatedSkyApp/app/src/main/res/values/styles.xml",
"chars": 383,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
},
{
"path": "Android/AnimatedSkyApp/build.gradle",
"chars": 654,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n\n "
},
{
"path": "Android/AnimatedSkyApp/gradle.properties",
"chars": 726,
"preview": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will ov"
},
{
"path": "Android/AnimatedSkyApp/gradlew",
"chars": 5296,
"preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n## Gradle start up"
},
{
"path": "Android/AnimatedSkyApp/gradlew.bat",
"chars": 2260,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "Android/AnimatedSkyApp/settings.gradle",
"chars": 15,
"preview": "include ':app'\n"
},
{
"path": "Android/BackgroundReplacementApp/.gitignore",
"chars": 877,
"preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the ART/Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated file"
},
{
"path": "Android/BackgroundReplacementApp/README.md",
"chars": 3639,
"preview": "# Automatic Background Replacement with People Segmentation\n\n[ ;"
},
{
"path": "Android/BackgroundReplacementApp/app/src/main/res/values/fritz.xml",
"chars": 80,
"preview": "<resources>\n <string name=\"fritz_api_key\">Your API Key</string>\n</resources>\n"
},
{
"path": "Android/BackgroundReplacementApp/app/src/main/res/values/strings.xml",
"chars": 164,
"preview": "<resources>\n <string name=\"app_name\">Background Changer</string>\n <string name=\"camera_error\">This device doesn\\'t"
},
{
"path": "Android/BackgroundReplacementApp/app/src/main/res/values/styles.xml",
"chars": 383,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
},
{
"path": "Android/BackgroundReplacementApp/build.gradle",
"chars": 654,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n\n "
},
{
"path": "Android/BackgroundReplacementApp/gradle.properties",
"chars": 726,
"preview": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will ov"
},
{
"path": "Android/BackgroundReplacementApp/gradlew",
"chars": 5296,
"preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n## Gradle start up"
},
{
"path": "Android/BackgroundReplacementApp/gradlew.bat",
"chars": 2260,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "Android/BackgroundReplacementApp/settings.gradle",
"chars": 15,
"preview": "include ':app'\n"
},
{
"path": "Android/CameraBoilerplateApp/.gitignore",
"chars": 877,
"preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the ART/Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated file"
},
{
"path": "Android/CameraBoilerplateApp/README.md",
"chars": 3278,
"preview": "# Camera Boilerplate\n\n[ ;"
},
{
"path": "Android/CameraBoilerplateApp/app/src/main/res/values/fritz.xml",
"chars": 80,
"preview": "<resources>\n <string name=\"fritz_api_key\">Your API Key</string>\n</resources>\n"
},
{
"path": "Android/CameraBoilerplateApp/app/src/main/res/values/strings.xml",
"chars": 167,
"preview": "<resources>\n <string name=\"app_name\">Fritz Camera Template</string>\n <string name=\"camera_error\">This device doesn"
},
{
"path": "Android/CameraBoilerplateApp/app/src/main/res/values/styles.xml",
"chars": 383,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
},
{
"path": "Android/CameraBoilerplateApp/app/src/test/java/ai/fritz/camera/ExampleUnitTest.java",
"chars": 376,
"preview": "package ai.fritz.camera;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Example local unit test, whi"
},
{
"path": "Android/CameraBoilerplateApp/build.gradle",
"chars": 654,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n\n "
},
{
"path": "Android/CameraBoilerplateApp/gradle.properties",
"chars": 726,
"preview": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will ov"
},
{
"path": "Android/CameraBoilerplateApp/gradlew",
"chars": 5296,
"preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n## Gradle start up"
},
{
"path": "Android/CameraBoilerplateApp/gradlew.bat",
"chars": 2260,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "Android/CameraBoilerplateApp/settings.gradle",
"chars": 15,
"preview": "include ':app'\n"
},
{
"path": "Android/FritzAIStudio/LICENSE.md",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "Android/FritzAIStudio/README.md",
"chars": 4761,
"preview": "# Fritz AI Studio App\n\n[ ;"
},
{
"path": "Android/FritzAIStudio/app/src/main/res/values/fritz.xml",
"chars": 80,
"preview": "<resources>\n <string name=\"fritz_api_key\">Your API Key</string>\n</resources>\n"
},
{
"path": "Android/FritzAIStudio/app/src/main/res/values/ic_launcher_background.xml",
"chars": 121,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"ic_launcher_background\">#000000</color>\n</resources>"
},
{
"path": "Android/FritzAIStudio/app/src/main/res/values/strings.xml",
"chars": 4316,
"preview": "<resources>\n <string name=\"app_name\">Fritz AI Studio</string>\n <!-- In the MainActivity -->\n <string name=\"demo"
},
{
"path": "Android/FritzAIStudio/app/src/main/res/values/styles.xml",
"chars": 2084,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.DayNight.NoActionBa"
},
{
"path": "Android/FritzAIStudio/build.gradle",
"chars": 732,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n\n "
},
{
"path": "Android/FritzAIStudio/gradle.properties",
"chars": 730,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
},
{
"path": "Android/FritzAIStudio/gradlew",
"chars": 5296,
"preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n## Gradle start up"
},
{
"path": "Android/FritzAIStudio/gradlew.bat",
"chars": 2260,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "Android/FritzAIStudio/settings.gradle",
"chars": 15,
"preview": "include ':app'\n"
},
{
"path": "Android/FritzVisionVideoApp/.gitignore",
"chars": 208,
"preview": "*.iml\n.gradle\n/local.properties\n/.idea/caches\n/.idea/libraries\n/.idea/modules.xml\n/.idea/workspace.xml\n/.idea/navEditor."
},
{
"path": "Android/FritzVisionVideoApp/app/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "Android/FritzVisionVideoApp/app/build.gradle",
"chars": 1504,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion 29\n defaultConfig {\n // MUST MATCH TH"
},
{
"path": "Android/FritzVisionVideoApp/app/gradlew",
"chars": 5296,
"preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n## Gradle start up"
},
{
"path": "Android/FritzVisionVideoApp/app/gradlew.bat",
"chars": 2260,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "Android/FritzVisionVideoApp/app/proguard-rules.pro",
"chars": 751,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "Android/FritzVisionVideoApp/app/src/androidTest/java/ai/fritz/fritzvisionvideo/ExampleInstrumentedTest.java",
"chars": 766,
"preview": "package ai.fritz.fritzvisionvideo;\n\nimport android.content.Context;\n\nimport androidx.test.platform.app.InstrumentationRe"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/AndroidManifest.xml",
"chars": 1248,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"ai.fritz.fritzvisionvideo\">\n\n <uses"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/MainActivity.java",
"chars": 5499,
"preview": "package ai.fritz.fritzvisionvideo;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.graphi"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/VideoActivity.java",
"chars": 7442,
"preview": "package ai.fritz.fritzvisionvideo;\n\nimport android.app.Activity;\nimport android.content.Intent;\nimport android.media.Med"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/MaskCutStrategy.java",
"chars": 1950,
"preview": "package ai.fritz.fritzvisionvideo.strategies;\n\nimport android.os.Parcel;\n\nimport ai.fritz.vision.FritzVision;\nimport ai."
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/ObjectPoseStrategy.java",
"chars": 1970,
"preview": "package ai.fritz.fritzvisionvideo.strategies;\n\nimport android.os.Parcel;\n\nimport ai.fritz.vision.FritzVision;\nimport ai."
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/PoseDoubleMaskStrategy.java",
"chars": 2699,
"preview": "package ai.fritz.fritzvisionvideo.strategies;\n\nimport android.os.Parcel;\n\nimport ai.fritz.vision.FritzVision;\nimport ai."
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/StylizeBackgroundStrategy.java",
"chars": 2110,
"preview": "package ai.fritz.fritzvisionvideo.strategies;\n\nimport android.os.Parcel;\n\nimport ai.fritz.core.FritzOnDeviceModel;\nimpor"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/StylizeHairStrategy.java",
"chars": 1900,
"preview": "package ai.fritz.fritzvisionvideo.strategies;\n\nimport android.os.Parcel;\n\nimport ai.fritz.core.FritzOnDeviceModel;\nimpor"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/VideoFilterStrategy.java",
"chars": 624,
"preview": "package ai.fritz.fritzvisionvideo.strategies;\n\nimport android.os.Parcel;\nimport android.os.Parcelable;\n\nimport ai.fritz."
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/strategies/customfilters/StylizeHairFilter.java",
"chars": 2006,
"preview": "package ai.fritz.fritzvisionvideo.strategies.customfilters;\n\nimport android.graphics.Bitmap;\n\nimport ai.fritz.vision.Fri"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/ui/DemoAdapter.java",
"chars": 2454,
"preview": "package ai.fritz.fritzvisionvideo.ui;\n\nimport android.view.LayoutInflater;\nimport android.view.ViewGroup;\nimport android"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/ui/DemoItem.java",
"chars": 1010,
"preview": "package ai.fritz.fritzvisionvideo.ui;\n\nimport android.view.View;\n\n/**\n * Helper class to show demo items for the DemoAda"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/java/ai/fritz/fritzvisionvideo/ui/SeparatorDecoration.java",
"chars": 2854,
"preview": "package ai.fritz.fritzvisionvideo.ui;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.gr"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/drawable/ic_launcher_background.xml",
"chars": 5606,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:wi"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml",
"chars": 1880,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:aapt=\"http://schemas.android.com/aapt\"\n "
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/font/sf_display.xml",
"chars": 889,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<font-family xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/layout/activity_main.xml",
"chars": 639,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas."
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/layout/activity_video.xml",
"chars": 1769,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas."
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/layout/app_bar.xml",
"chars": 545,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.appcompat.widget.Toolbar xmlns:android=\"http://schemas.android.com/apk/"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/layout/list_item_demo.xml",
"chars": 879,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/menu/video_menu.xml",
"chars": 364,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n xmlns:android=\"http"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
"chars": 272,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <b"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
"chars": 272,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <b"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/values/colors.xml",
"chars": 250,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"colorPrimary\">#000</color>\n <color name=\"colorPri"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/values/dimens.xml",
"chars": 1084,
"preview": "<!--\n Copyright 2013 The Android Open Source Project\n\n Licensed under the Apache License, Version 2.0 (the \"License\");"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/values/fritz.xml",
"chars": 80,
"preview": "<resources>\n <string name=\"fritz_api_key\">Your API Key</string>\n</resources>\n"
},
{
"path": "Android/FritzVisionVideoApp/app/src/main/res/values/strings.xml",
"chars": 1350,
"preview": "<resources>\n <string name=\"app_name\">Video Processing</string>\n <string name=\"camera_error\">This device doesn\\'t s"
}
]
// ... and 501 more files (download for full content)
About this extraction
This page contains the full source code of the fritzlabs/fritz-examples GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 701 files (1.9 MB), approximately 513.1k tokens, and a symbol index with 1059 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.