Subject
Stay organized with collections
Save and categorize content based on your preferences.
Public Method Summary
Bitmap
|
getBitmap()
Returns the masked bitmap for this subject.
|
FloatBuffer
|
|
int |
getHeight()
Returns the height of this subject.
|
int |
getStartX()
Returns the starting x-coordinate of this subject in the input image.
|
int |
getStartY()
Returns the starting y-coordinate of this subject in the input image.
|
int |
getWidth()
Returns the width of this subject.
|
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()
|
Public Methods
public int getHeight ()
Returns the height of this subject.
public int getStartX ()
Returns the starting x-coordinate of this subject in the input image.
public int getStartY ()
Returns the starting y-coordinate of this subject in the input image.
public int getWidth ()
Returns the width of this subject.
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 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eSubject\u003c/code\u003e represents a segmented subject from an input image, identified by the \u003ccode\u003eSubjectSegmenter\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eProvides access to the subject's masked bitmap, confidence mask, height, width, and starting coordinates within the image.\u003c/p\u003e\n"],["\u003cp\u003eBitmap and confidence mask are optional and require enabling through \u003ccode\u003eSubjectSegmenterOptions\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize \u003ccode\u003eSubject\u003c/code\u003e to isolate and manipulate identified subjects within images.\u003c/p\u003e\n"],["\u003cp\u003eHeight, width, startX, and startY offer insights into the subject's position and dimensions within the original image.\u003c/p\u003e\n"]]],["The `Subject` class, derived from `Object`, represents a segmented portion of an image. It provides methods to access subject data: `getBitmap()` retrieves the masked bitmap, while `getConfidenceMask()` returns a confidence mask; both can be null if not enabled. `getHeight()` and `getWidth()` return the subject's dimensions, while `getStartX()` and `getStartY()` indicate the subject's position within the original image. It also inherits multiple methods from Object.\n"],null,["# Subject\n\npublic class **Subject** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nA segmented subject from the input image by [SubjectSegmenter](/android/reference/com/google/mlkit/vision/segmentation/subject/SubjectSegmenter). \n\n### Public Method Summary\n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html) | [getBitmap](/android/reference/com/google/mlkit/vision/segmentation/subject/Subject#getBitmap())() Returns the masked bitmap for this subject. |\n| [FloatBuffer](//developer.android.com/reference/java/nio/FloatBuffer.html) | [getConfidenceMask](/android/reference/com/google/mlkit/vision/segmentation/subject/Subject#getConfidenceMask())() Returns the confidence mask for this subject. |\n| int | [getHeight](/android/reference/com/google/mlkit/vision/segmentation/subject/Subject#getHeight())() Returns the height of this subject. |\n| int | [getStartX](/android/reference/com/google/mlkit/vision/segmentation/subject/Subject#getStartX())() Returns the starting x-coordinate of this subject in the input image. |\n| int | [getStartY](/android/reference/com/google/mlkit/vision/segmentation/subject/Subject#getStartY())() Returns the starting y-coordinate of this subject in the input image. |\n| int | [getWidth](/android/reference/com/google/mlkit/vision/segmentation/subject/Subject#getWidth())() Returns the width of this subject. |\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\nPublic Methods\n--------------\n\n#### public [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html)\n**getBitmap** ()\n\nReturns the masked bitmap for this subject.\n\nReturns null if it is not enabled by [SubjectSegmenterOptions.SubjectResultOptions.Builder.enableSubjectBitmap()](/android/reference/com/google/mlkit/vision/segmentation/subject/SubjectSegmenterOptions.SubjectResultOptions.Builder#enableSubjectBitmap()) \n\n#### public [FloatBuffer](//developer.android.com/reference/java/nio/FloatBuffer.html)\n**getConfidenceMask** ()\n\nReturns the confidence mask for this subject.\n\nReturns null if it is not enabled by [SubjectSegmenterOptions.SubjectResultOptions.Builder.enableConfidenceMask()](/android/reference/com/google/mlkit/vision/segmentation/subject/SubjectSegmenterOptions.SubjectResultOptions.Builder#enableConfidenceMask()) \n\n#### public int **getHeight** ()\n\nReturns the height of this subject. \n\n#### public int **getStartX** ()\n\nReturns the starting x-coordinate of this subject in the input image. \n\n#### public int **getStartY** ()\n\nReturns the starting y-coordinate of this subject in the input image. \n\n#### public int **getWidth** ()\n\nReturns the width of this subject."]]