Dynamic frame generation based on generative pipelines
A method, apparatus, and non-transitory computer readable medium for image processing include obtaining a document element and an input prompt, wherein the input prompt describes a decoration element for the document element; generating a decoration mask based on the document element, wherein the decoration mask indicates a location for the decoration element; generating a decoration image based on the input prompt and the decoration mask, wherein the decoration image includes the decoration element; and generating a decorated document by combining the document element and the decoration image.
1 . A method comprising:
obtaining a document element and an input prompt, wherein the input prompt describes a decoration element for the document element;
generating a decoration mask based on the document element, wherein the decoration mask indicates a location for the decoration element;
generating, using an image generation model, a decoration image based on the input prompt and the decoration mask, wherein the decoration image includes the decoration element, wherein generating the decoration image comprises obtaining the decoration element, performing a tiling operation using the decoration element to obtain a decoration pattern, and applying the decoration mask to the decoration pattern to obtain a masked decoration pattern, and wherein the decoration image is generated based on the masked decoration pattern; and
generating a decorated document by combining the document element and the decoration image.
2 . The method of claim 1 , further comprising:
stylizing the decoration element to obtain a stylized decoration element, wherein the decoration pattern is based on the stylized decoration element.
3 . The method of claim 1 , further comprising:
obtaining a tiling parameter from a user, wherein the decoration element is tiled based on the tiling parameter.
4 . The method of claim 1 , further comprising:
generating, using the image generation model, an additional decoration image based on the input prompt and an additional decoration mask, wherein the decorated document includes a first page with the decoration image and a second page with the additional decoration image.
5 . The method of claim 1 , further comprising:
receiving a mask edit input from a user; and
modifying the decoration mask based on the mask edit input to obtain a modified decoration mask, wherein the decoration image is generated based on the decoration mask.
6 . The method of claim 1 , wherein generating the decoration image comprises:
performing a combination of a first diffusion-based editing algorithm and a second diffusion-based editing algorithm.
7 . The method of claim 6 , wherein:
the first diffusion-based editing algorithm comprises a SDEdit and the second diffusion-based editing algorithm comprises a DiffEdit.
8 . The method of claim 6 , further comprising:
obtaining a stylization strength parameter from a user, wherein the combination of the first diffusion-based editing algorithm and the second diffusion-based editing algorithm are combined based on the stylization strength parameter.
9 . The method of claim 1 , further comprising:
removing a background region from the decoration image to obtain a segmented decoration image, wherein the decorated document is generated using the segmented decoration image.
10 . The method of claim 1 , further comprising:
selecting a first decoration mode based on a presence of the input prompt, wherein the decorated document is generated based on the first decoration mode.
11 . The method of claim 1 , further comprising:
selecting a second decoration mode; and
generating an alternative decorated document independent of the input prompt based on the second decoration mode.
12 . A non-transitory computer readable medium storing code for image processing, the code comprising instructions executable by a processor to:
obtain a document element and a decoration element;
perform a tiling operation using the decoration element to obtain a decoration pattern;
generate a decoration mask based on the document element and the decoration pattern, wherein the decoration mask indicates a location for the decoration element;
generate a decoration image including the decoration element based on the decoration mask and the input prompt;
remove a background region from the decoration image to obtain a segmented decoration image; and
generate a decorated document by combining the document element and the segmented decoration image.
13 . The non-transitory computer readable medium of claim 12 , the code further comprising instructions executable by a processor to:
receive a mask edit input from a user; and
modify the decoration mask based on the mask edit input to obtain a modified decoration mask, wherein the decoration image is generated based on the decoration mask.
14 . The non-transitory computer readable medium of claim 12 , wherein generating the decoration image comprises:
performing a combination of a first diffusion-based editing algorithm and a second diffusion-based editing algorithm.
15 . An apparatus comprising:
at least one processor;
at least one memory storing instructions executable by the at least one processor to perform operations comprising:
generate a decoration mask based on a document element, wherein the decoration mask indicates a location for a decoration element;
generate a decoration pattern by performing a tiling operation using the decoration element;
generate, using an image generation model, a decoration image including the decoration pattern based on the decoration mask and an input prompt that describes the decoration element; and
generate a decorated document by combining the document element and the decoration image; and.
16 . The apparatus of claim 15 , the operations further comprising:
remove a background region from the decoration image to obtain a segmented decoration image, wherein the decorated document is generated using the segmented decoration image.
17 . The apparatus of claim 15 , further comprising:
a user interface configured to receive a stylization strength parameter, wherein the decoration image is generated based on the stylization strength parameter.
18 . The apparatus of claim 15 , wherein:
the image generation model comprises a diffusion model.