An ARCore sample demonstrating how to use camera images as an input for machine learning algorithms, and how to use the results of the inference model to create anchors in the AR scene.
This sample uses ML Kit's Object Detection and (optionally) Google's Cloud Vision API to infer object labels from camera images.
To try this app, you'll need the following:
- An ARCore compatible device running Google Play Services for AR (ARCore) 1.24 or later
- Android Studio 4.1 or later
By default, this sample uses ML Kit's built-in coarse classifier, which is only built for five categories and provides limited information about the detected objects.
For better classification results:
- Read Label images with a custom model on Android on ML Kit's documentation website.
- Modify
MLKitObjectAnalyzer.kt
inapp/src/main/java/com/google/ar/core/examples/java/ml/classification/
to specify a custom model.
This sample also supports results from the Google Cloud Vision API for even more information on detected objects.
To configure Google Cloud Vision APIs:
- Follow steps for configuring a Google Cloud project, enabling billing, enabling the API, and enabling a service account on Set up the Vision API documentation.
- Save the resulting service account key file to
app/src/main/res/raw/credentials.json
.
Copyright 2021 Google LLC
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
https://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.