Firebase ML Kit 101 : Landmark Recognition

Hitanshu Dhawan
Nov 20, 2018 · 4 min read

Firebase ML Kit Series

ML Kit’s Landmark Recognition

image courtesy: https://firebase.google.com/docs/ml-kit/recognize-landmarks

Let’s Code!

Step 1 : Add Firebase to your app

Step 2 : Include the dependency

dependencies {
// ...
implementation 'com.google.firebase:firebase-ml-vision:19.0.2'
}

Step 3 : Get! — the Image

creating FirebaseVisionImage object from different image types
val image = FirebaseVisionImage.fromBitmap(bitmap)

Step 4 : Set! — the Model

val detector = FirebaseVision.getInstance().visionCloudLandmarkDetector
val options = FirebaseVisionCloudDetectorOptions.Builder()
.setModelType(FirebaseVisionCloudDetectorOptions.LATEST_MODEL)
.setMaxResults(5)
.build()

val detector = FirebaseVision.getInstance().getVisionCloudLandmarkDetector(options)

Step 5 : Gooo!

detector.detectInImage(image)
.addOnSuccessListener {
//
Task completed successfully
}
.addOnFailureListener {
//
Task failed with an exception
}

Step 6 : Extract the information

Have a Look!



AndroIDIOTS

An android developer publication to stay updated with whats new in android, best practices and how to become a better android developer

Hitanshu Dhawan

Written by

Software Engineer @UrbanClap | Google Certified Android Developer

AndroIDIOTS

An android developer publication to stay updated with whats new in android, best practices and how to become a better android developer