BitmapMlImageBuilder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Public Constructors
public
BitmapMlImageBuilder
( Bitmap
bitmap)
Creates the builder with a mandatory Bitmap
.
Also calls setRotation(int)
to set the optional properties. If not set, the values will
be set with default:
Parameters
bitmap
image data object.
public
BitmapMlImageBuilder
( Context
context, Uri
uri)
Creates the builder to build MlImage
from
a file.
Also calls setRotation(int)
to set the optional properties. If not set, the values will
be set with default:
Parameters
Public Methods
Throws
if the rotation value is not 0, 90, 180 or 270.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eBitmapMlImageBuilder\u003c/code\u003e facilitates the creation of \u003ccode\u003eMlImage\u003c/code\u003e objects from \u003ccode\u003eBitmap\u003c/code\u003e data or image files.\u003c/p\u003e\n"],["\u003cp\u003eIt offers flexibility by accepting both mutable and immutable \u003ccode\u003eBitmap\u003c/code\u003e instances, but modification after passing is discouraged to maintain data integrity.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage \u003ccode\u003eBitmapExtractor\u003c/code\u003e to retrieve the original \u003ccode\u003eBitmap\u003c/code\u003e passed to the builder.\u003c/p\u003e\n"],["\u003cp\u003eRotation can be set for the generated \u003ccode\u003eMlImage\u003c/code\u003e using \u003ccode\u003esetRotation\u003c/code\u003e, with a default value of 0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild\u003c/code\u003e method is the final step to generate the \u003ccode\u003eMlImage\u003c/code\u003e instance after configuration.\u003c/p\u003e\n"]]],[],null,["# BitmapMlImageBuilder\n\npublic class **BitmapMlImageBuilder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilds [MlImage](/android/reference/com/google/android/odml/image/MlImage) from\n[Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html).\n\nYou can pass in either mutable or immutable [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html). However\nonce [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html) is passed\nin, to keep data integrity you shouldn't modify content in it.\n\nUse [BitmapExtractor](/android/reference/com/google/android/odml/image/BitmapExtractor)\nto get [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html) you passed\nin. \n\n### Public Constructor Summary\n\n|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [BitmapMlImageBuilder](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder#BitmapMlImageBuilder(android.graphics.Bitmap))([Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html) bitmap) Creates the builder with a mandatory [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html). |\n| | [BitmapMlImageBuilder](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder#BitmapMlImageBuilder(android.content.Context,%20android.net.Uri))([Context](//developer.android.com/reference/android/content/Context.html) context, [Uri](//developer.android.com/reference/android/net/Uri.html) uri) Creates the builder to build [MlImage](/android/reference/com/google/android/odml/image/MlImage) from a file. |\n\n### Public Method Summary\n\n|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [MlImage](/android/reference/com/google/android/odml/image/MlImage) | [build](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder#build())() Builds an [MlImage](/android/reference/com/google/android/odml/image/MlImage) instance. |\n| [BitmapMlImageBuilder](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder) | [setRotation](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder#setRotation(int))(int rotation) Sets value for [MlImage.getRotation()](/android/reference/com/google/android/odml/image/MlImage#getRotation()). |\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 Constructors\n-------------------\n\n#### public **BitmapMlImageBuilder** ([Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html) bitmap)\n\nCreates the builder with a mandatory [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html).\n\nAlso calls [setRotation(int)](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder#setRotation(int)) to set the optional properties. If not set, the values will\nbe set with default:\n\n- rotation: 0 \n\n##### Parameters\n\n| bitmap | image data object. |\n|--------|--------------------|\n\n#### public **BitmapMlImageBuilder** ([Context](//developer.android.com/reference/android/content/Context.html) context, [Uri](//developer.android.com/reference/android/net/Uri.html) uri)\n\nCreates the builder to build [MlImage](/android/reference/com/google/android/odml/image/MlImage) from\na file.\n\nAlso calls [setRotation(int)](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder#setRotation(int)) to set the optional properties. If not set, the values will\nbe set with default:\n\n- rotation: 0 \n\n##### Parameters\n\n| context | the application context. |\n| uri | the path to the resource file. |\n|---------|--------------------------------|\n\n##### Throws\n\n| [IOException](//developer.android.com/reference/java/io/IOException.html) | |\n|---------------------------------------------------------------------------|---|\n\nPublic Methods\n--------------\n\n#### public [MlImage](/android/reference/com/google/android/odml/image/MlImage)\n**build** ()\n\nBuilds an [MlImage](/android/reference/com/google/android/odml/image/MlImage)\ninstance. \n\n#### public [BitmapMlImageBuilder](/android/reference/com/google/android/odml/image/BitmapMlImageBuilder)\n**setRotation** (int rotation)\n\nSets value for [MlImage.getRotation()](/android/reference/com/google/android/odml/image/MlImage#getRotation()). \n\n##### Throws\n\n| [IllegalArgumentException](//developer.android.com/reference/java/lang/IllegalArgumentException.html) | if the rotation value is not 0, 90, 180 or 270. |\n|-------------------------------------------------------------------------------------------------------|-------------------------------------------------|"]]