Skip to content

Commit ad40654

Browse files
author
David Motsonashvili
committed
documentation fixes for M168
1 parent 042827d commit ad40654

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenControlType.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,26 @@ package com.google.firebase.ai.type
1919
public class ImagenControlType internal constructor(internal val value: String) {
2020
public companion object {
2121

22-
/** Use edge detection to ensure the new image follow the same outlines */
22+
/**
23+
* Use edge detection to ensure the new image follows the same outlines as the reference image.
24+
*/
2325
@JvmField public val CANNY: ImagenControlType = ImagenControlType("CONTROL_TYPE_CANNY")
2426

25-
/** Use enhanced edge detection to ensure the new image follow similar outlines */
27+
/**
28+
* Use enhanced edge detection to ensure the new image follows the same outlines as the
29+
* reference image.
30+
*/
2631
@JvmField public val SCRIBBLE: ImagenControlType = ImagenControlType("CONTROL_TYPE_SCRIBBLE")
2732

28-
/** Use face mesh control to ensure that the new image has the same facial expressions */
33+
/**
34+
* Use face mesh control to ensure that the new image has the same facial expressions as the
35+
* reference image.
36+
*/
2937
@JvmField public val FACE_MESH: ImagenControlType = ImagenControlType("CONTROL_TYPE_FACE_MESH")
3038

3139
/**
3240
* Use color superpixels to ensure that the new image is similar in shape and color to the
33-
* original
41+
* reference image.
3442
*/
3543
@JvmField
3644
public val COLOR_SUPERPIXEL: ImagenControlType =

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditMode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ImagenEditMode private constructor(internal val value: String) {
2525
/** Removes an element from an image */
2626
@JvmField
2727
public val INPAINT_REMOVAL: ImagenEditMode = ImagenEditMode("EDIT_MODE_INPAINT_REMOVAL")
28-
/** Extend the borders of an image outwards */
28+
/** Extends the borders of an image outwards */
2929
@JvmField public val OUTPAINT: ImagenEditMode = ImagenEditMode("EDIT_MODE_OUTPAINT")
3030
}
3131
}

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenReferenceImage.kt

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ internal constructor(
8080
* @param referenceId the reference ID for this image, to be referenced in the prompt
8181
* @param enableComputation requests that the reference image be generated serverside instead of
8282
* provided
83-
* @param superpixelRegionSize if type is COLOR_SUPERPIXEL and [enableComputation] is true, this
84-
* will control the size of each superpixel region in pixels for the generated referenced image
85-
* @param superpixelRuler if type is COLOR_SUPERPIXEL and [enableComputation] is true, this will
86-
* control the superpixel smoothness factor for the generated referenced image
83+
* @param superpixelRegionSize if type is [ImagenControlType.COLOR_SUPERPIXEL] and
84+
* [enableComputation] is true, this will control the size of each superpixel region in pixels for
85+
* the generated referenced image
86+
* @param superpixelRuler if type is [ImagenControlType.COLOR_SUPERPIXEL] and [enableComputation] is
87+
* true, this will control the superpixel smoothness factor for the generated referenced image
8788
*/
8889
@PublicPreviewAPI
8990
public class ImagenControlReference(
@@ -102,9 +103,8 @@ public class ImagenControlReference(
102103
) {}
103104

104105
/**
105-
* Represents a reference image for Imagen editing which will mask of a region to be edited. This
106-
* image (generated or provided) should contain only black and white pixels, with black representing
107-
* parts of the image which should not change.
106+
* Represents a mask for Imagen editing. This image (generated or provided) should contain only
107+
* black and white pixels, with black representing parts of the image which should not change.
108108
*/
109109
@PublicPreviewAPI
110110
public abstract class ImagenMaskReference
@@ -113,17 +113,16 @@ internal constructor(maskConfig: ImagenMaskConfig, image: ImagenInlineImage? = n
113113

114114
public companion object {
115115
/**
116-
* Generates these two reference images in order:
116+
* Generates two reference images of [ImagenRawImage] and [ImagenRawMask]. These images are
117+
* generated in this order:
117118
* * One [ImagenRawImage] containing the original image, padded out to the new dimensions with
118119
* black pixels, with the original image placed at the given placement
119120
* * One [ImagenRawMask] of the same dimensions containing white everywhere except at the
120-
* placement original image.
121-
*
122-
* This is the format expected by Imagen for outpainting requests.
121+
* placement original image. This is the format expected by Imagen for outpainting requests.
123122
*
124123
* @param image the original image
125-
* @param newDimensions the new dimensions for outpainting. This *must* be more than the
126-
* original image.
124+
* @param newDimensions the new dimensions for outpainting. These new dimensions *must* be more
125+
* than the original image.
127126
* @param newPosition the placement of the original image within the new outpainted image.
128127
*/
129128
@JvmOverloads
@@ -190,8 +189,8 @@ internal constructor(maskConfig: ImagenMaskConfig, image: ImagenInlineImage? = n
190189
/**
191190
* A generated mask image which will auto-detect and mask out the background. The background will be
192191
* white, and the foreground black
193-
* @param dilation the amount to dilate the mask, this can help smooth the borders of an edit and
194-
* make it seem more convincing. For example, 0.05 would dilate the mask 5%.
192+
* @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and
193+
* make it seem more convincing. For example, `0.05` will dilate the mask 5%.
195194
*/
196195
@PublicPreviewAPI
197196
public class ImagenBackgroundMask(dilation: Double? = null) :
@@ -200,21 +199,20 @@ public class ImagenBackgroundMask(dilation: Double? = null) :
200199
/**
201200
* A generated mask image which will auto-detect and mask out the foreground. The background will be
202201
* black, and the foreground white
203-
* @param dilation the amount to dilate the mask, this can help smooth the borders of an edit and
204-
* make it seem more convincing. For example, 0.05 would dilate the mask 5%.
202+
* @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and
203+
* make it seem more convincing. For example, `0.05` will dilate the mask 5%.
205204
*/
206205
@PublicPreviewAPI
207206
public class ImagenForegroundMask(dilation: Double? = null) :
208207
ImagenMaskReference(maskConfig = ImagenMaskConfig(ImagenMaskMode.FOREGROUND, dilation)) {}
209208

210209
/**
211-
* Represents a reference image for Imagen editing which will mask of a region to be edited. This
212-
* image should contain only black and white pixels, with black representing parts of the image
213-
* which should not change.
210+
* Represents a mask for Imagen editing. This image should contain only black and white pixels, with
211+
* black representing parts of the image which should not change.
214212
*
215213
* @param mask the mask image
216-
* @param dilation the amount to dilate the mask, this can help smooth the borders of an edit and
217-
* make it seem more convincing. For example, 0.05 would dilate the mask 5%.
214+
* @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and
215+
* make it seem more convincing. For example, `0.05` will dilate the mask 5%.
218216
*/
219217
@PublicPreviewAPI
220218
public class ImagenRawMask(mask: ImagenInlineImage, dilation: Double? = null) :
@@ -226,11 +224,11 @@ public class ImagenRawMask(mask: ImagenInlineImage, dilation: Double? = null) :
226224
/**
227225
* Represents a generated mask for Imagen editing which masks out certain objects using object
228226
* detection.
229-
* @param classes the list of segmentation IDs for objects to detect and mask out. See
230-
* [here](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api-edit#segment-ids)
231-
* for a list of segmentation IDs
232-
* @param dilation the amount to dilate the mask, this can help smooth the borders of an edit and
233-
* make it seem more convincing. For example, 0.05 would dilate the mask 5%.
227+
* @param classes the list of segmentation IDs for objects to detect and mask out. Find a
228+
* [list of segmentation IDs](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api-edit#segment-ids)
229+
* in the Vertex AI documentation.
230+
* @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and
231+
* make it seem more convincing. For example, `0.05` will dilate the mask 5%.
234232
*/
235233
@PublicPreviewAPI
236234
public class ImagenSemanticMask(classes: List<Int>, dilation: Double? = null) :

0 commit comments

Comments
 (0)