FirebaseVisionObjectDetector
Stay organized with collections
Save and categorize content based on your preferences.
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
From interface java.io.Closeable
From interface java.lang.AutoCloseable
Public Methods
Detects objects from supplied image.
For best efficiency, create a
FirebaseVisionImage
object using following way:
All other
FirebaseVisionImage
factory methods will work as well, but possibly slightly
slower.
Note that the width and height of the provided image cannot be less than 32.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-08-14 UTC.
[null,null,["Last updated 2020-08-14 UTC."],[],[],null,["# FirebaseVisionObjectDetector\n\npublic class **FirebaseVisionObjectDetector** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nimplements [Closeable](//developer.android.com/reference/java/io/Closeable.html) [Closeable](//developer.android.com/reference/java/io/Closeable.html) \n**This class is deprecated.** \n\nThe standalone ML Kit SDK replaces this API. For more information, refer to the [migration guide](//developers.google.com/ml-kit/migration).\n\nDetector for finding [FirebaseVisionObject](/docs/reference/android/com/google/firebase/ml/vision/objects/FirebaseVisionObject)s\nin a supplied image.\n\nA object detector is created via [getOnDeviceObjectDetector(FirebaseVisionObjectDetectorOptions)](/docs/reference/android/com/google/firebase/ml/vision/FirebaseVision#getOnDeviceObjectDetector(com.google.firebase.ml.vision.objects.FirebaseVisionObjectDetectorOptions)) or [getOnDeviceObjectDetector()](/docs/reference/android/com/google/firebase/ml/vision/FirebaseVision#getOnDeviceObjectDetector()), if you wish to use the default options. For example,\nthe code below creates an object detector with default options. \n\n FirebaseVisionObjectDetector objectDetector =\n FirebaseVision.getInstance().getOnDeviceObjectDetector();\n \nTo perform object detection in an image, you first need to create an instance of `\n`[FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) from a [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html), [ByteBuffer](//developer.android.com/reference/java/nio/ByteBuffer.html), etc. See [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) documentation for more details. For example, the code below creates a [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) from a [ByteBuffer](//developer.android.com/reference/java/nio/ByteBuffer.html). \n\n FirebaseVisionImage image\n = FirebaseVisionImage.fromByteBuffer(byteBuffer, imageMetadata);\n \nThen the code below can detect objects in the supplied [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage). \n\n\n Task\u003cList\u003cFirebaseVisionObject\u003e\u003e task = objectDetector.processImage(image);\n task.addOnSuccessListener(...).addOnFailureListener(...);\n \n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| void | [close](/docs/reference/android/com/google/firebase/ml/vision/objects/FirebaseVisionObjectDetector#close())() |\n| [Task](//developers.google.com/android/reference/com/google/android/gms/tasks/Task.html)\\\u003c[List](//developer.android.com/reference/java/util/List.html)\\\u003c[FirebaseVisionObject](/docs/reference/android/com/google/firebase/ml/vision/objects/FirebaseVisionObject)\\\u003e\\\u003e | [processImage](/docs/reference/android/com/google/firebase/ml/vision/objects/FirebaseVisionObjectDetector#processImage(com.google.firebase.ml.vision.common.FirebaseVisionImage))([FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) image) Detects objects from supplied image. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface java.io.Closeable \n\n|---------------|---------|\n| abstract void | close() |\n\nFrom interface java.lang.AutoCloseable \n\n|---------------|---------|\n| abstract void | close() |\n\nPublic Methods\n--------------\n\n#### public void **close** ()\n\n##### Throws\n\n| [IOException](//developer.android.com/reference/java/io/IOException.html) | |\n|---------------------------------------------------------------------------|---|\n\n#### public [Task](//developers.google.com/android/reference/com/google/android/gms/tasks/Task.html)\\\u003c[List](//developer.android.com/reference/java/util/List.html)\\\u003c[FirebaseVisionObject](/docs/reference/android/com/google/firebase/ml/vision/objects/FirebaseVisionObject)\\\u003e\\\u003e\n**processImage** ([FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) image)\n\nDetects objects from supplied image.\n\nFor best efficiency, create a [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) object using following way:\n\n- [fromByteBuffer(ByteBuffer, FirebaseVisionImageMetadata)](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage#fromByteBuffer(java.nio.ByteBuffer, com.google.firebase.ml.vision.common.FirebaseVisionImageMetadata)) if you need to pre-process the image. E.g. allocate a direct [ByteBuffer](//developer.android.com/reference/java/nio/ByteBuffer.html) and write processed pixels into the [ByteBuffer](//developer.android.com/reference/java/nio/ByteBuffer.html).\n\nAll other [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) factory methods will work as well, but possibly slightly slower.\n\nNote that the width and height of the provided image cannot be less than 32. \n\n##### Returns\n\n- A [Task](//developers.google.com/android/reference/com/google/android/gms/tasks/Task.html) that asynchronously returns a [List](//developer.android.com/reference/java/util/List.html) of detected [FirebaseVisionObject](/docs/reference/android/com/google/firebase/ml/vision/objects/FirebaseVisionObject)s."]]