ImageGenerator

公開最終類別 ImageGenerator

透過文字提示產生圖片。

巢狀類別

類別 ImageGenerator.ConditionOptions 條件類型和外掛程式模型的設定選項
類別 ImageGenerator.ImageGeneratorOptions 設定 ImageGenerator 的選項。 

公用方法

void
close()
關閉並清除工作執行器。
MPImage
createConditionImage(MPImage sourceConditionImage、ImageGenerator.ConditionOptions.ConditionTypeconditionType)
從來源映像檔建立指定條件類型的條件映像檔。
Static ImageGenerator
Static ImageGenerator
createFromOptions(內容結構定義、ImageGenerator.ImageGeneratorOptions generatorOptions、ImageGenerator.ConditionOptions conditionOptions)
使用外掛程式模型根據條件映像檔產生圖片時,從 ImageGenerator.ImageGeneratorOptionsImageGenerator.ConditionOptions 建立 ImageGenerator 執行個體。
ImageGeneratorResult
execute(boolean showResult)
可執行映像檔的疊代作業。
ImageGeneratorResult
generate(String 提示, MPImage sourceConditionImage、ImageGenerator.ConditionOptions.ConditionType conditionType、int 疊代、int 種子)
根據疊代的來源映像檔和指定的隨機種子,產生圖片。
ImageGeneratorResult
generate(字串提示、Int 疊代、int 種子)
針對疊代和指定的隨機種子產生圖片。
void
setInputs(String 提示、int 疊代、int 種子)
設定 ImageGenerator 的輸入。
void
setInputs(String 提示、MPImage sourceConditionImage、ImageGenerator.ConditionOptions.ConditionType conditionType、int 疊代、int 種子)
設定 ImageGenerator 的輸入。

繼承的方法

公用方法

public void close ()

關閉並清除工作執行器。

public MPImage createConditionImage (MPImage sourceConditionImage、ImageGenerator.ConditionOptions.ConditionTypeconditionType)

從來源映像檔建立指定條件類型的條件映像檔。目前支援臉部地標、深度圖片和邊緣圖片做為條件圖片。

參數
sourceConditionImage 用於建立條件映像檔的來源映像檔。
conditionType 用於指定條件圖片類型的 ImageGenerator.ConditionOptions.ConditionType

public static ImageGenerator createFromOptions (內容背景資訊、ImageGenerator.ImageGeneratorOptions generatorOptions)

參數
context Android ERROR(/Context)
generatorOptions ImageGenerator.ImageGeneratorOptions 執行個體。
擲回
如果 ImageGenerator 建立期間發生錯誤。

public static ImageGenerator createFromOptions (內容背景資訊、ImageGenerator.ImageGeneratorOptions generatorOptions, ImageGenerator.ConditionOptions conditionOptions)

使用外掛程式模型根據條件映像檔產生圖片時,從 ImageGenerator.ImageGeneratorOptionsImageGenerator.ConditionOptions 建立 ImageGenerator 執行個體。

參數
context Android ERROR(/Context)
generatorOptions ImageGenerator.ImageGeneratorOptions 執行個體。
conditionOptions ImageGenerator.ConditionOptions 執行個體。
擲回
如果 ImageGenerator 建立期間發生錯誤。

public ImageGeneratorResult execute (boolean showResult)

可執行映像檔的疊代作業。必須呼叫 iterations 次此方法才能產生最終圖片。必須先呼叫 ERROR(/setInputs),才能呼叫這個方法。

這是必須以疊代方式呼叫的疊代 API。

這個 API 有助於顯示中繼圖片產生結果,以及圖片產生進度。請注意,要求中繼結果會產生較長的延遲時間。請考慮改用 e2e API,以考量延遲時間。

使用範例:

imageGenerator.setInputs(prompt, iterations, seed); for (int step = 0; step <疊代 s; step++) { ImageGeneratorResult result = imageGenerator.execute(true); }

參數
showResult 是否在中繼疊代中取得產生的圖片結果。如果為 false,會傳回空值。無論 showResult 值為何,系統一律會在上次疊代時傳回產生的圖片結果。

public ImageGeneratorResult generate (String 提示、MPImage sourceConditionImage、ImageGenerator.ConditionOptions.ConditionTypeconditionType、int 疊代、Int Seed)

根據疊代的來源映像檔和指定的隨機種子,產生圖片。只有在使用條件選項建立 ImageGenerator 時才適用。

這是 e2e API,可執行 iterations 產生映像檔。建議您改用疊代 API 來擷取中繼結果。

參數
提示 描述要產生的圖片的文字提示。
sourceConditionImage 用於建立條件映像檔的來源映像檔,做為產生圖片的指引。
conditionType 用於指定條件圖片類型的 ImageGenerator.ConditionOptions.ConditionType
疊代 要產生圖片的疊代總數。
種子 產生圖片時使用的隨機種子。

public ImageGeneratorResult generate (String 提示、Int 疊代、Int 種子)

針對疊代和指定的隨機種子產生圖片。只有在建立 ImageGenerator 時沒有設定條件選項時,才有效。

這是 e2e API,可執行 iterations 產生映像檔。建議您改用疊代 API 來擷取中繼結果。

參數
提示 描述要產生的圖片的文字提示。
疊代 要產生圖片的疊代總數。
種子 產生圖片時使用的隨機種子。

public void setInputs (String提示、int 疊代 s、int 種子)

設定 ImageGenerator 的輸入。系統提供 ERROR(/setInputs)ERROR(/execute) 方法組合用於疊代用途。使用者必須在 ERROR(/execute)前呼叫 ERROR(/setInputs)。只有在建立 ImageGenerator 時沒有設定條件選項時,才有效。

參數
提示 描述要產生的圖片的文字提示。
疊代 要產生圖片的疊代總數。
種子 產生圖片時使用的隨機種子。

public void setInputs (String提示、MPImage sourceConditionImage、ImageGenerator.ConditionOptions.ConditionTypeconditionType、int 疊代、int 種子)

設定 ImageGenerator 的輸入。如要反覆使用,請組合使用 ERROR(/setInputs)ERROR(/execute)。使用者必須在 ERROR(/execute)前呼叫 ERROR(/setInputs)。只有在使用條件選項建立 ImageGenerator 時才適用。

參數
提示 描述要產生的圖片的文字提示。
sourceConditionImage 用於建立條件映像檔的來源映像檔,做為產生圖片的指引。
conditionType 用於指定條件圖片類型的 ImageGenerator.ConditionOptions.ConditionType
疊代 要產生圖片的疊代總數。
種子 產生圖片時使用的隨機種子。