<jupyter_start><jupyter_text>The code is by <NAME> (www.anastasiaopara.com)Based on "Image Quilting for Texture Synthesis and Transfer" and "Real-Time Texture Synthesis by Patch-Based Sampling" papers<jupyter_code>from makeGif import *
from patchBasedTextureSynthesis import *<jupyter_output><empty_output><jupyter_text>This part requires your input! :) So, what are all those parameters anyway? Glad you asked!* **exampleMapPath** - a string with a path to the example image that you want to generate more of!* **outputSize** - a path where you want your output image(s) to be saved to! (the algorithm will also create a txt file with your parameters, so you don't forget the setting you used for different images ^^)* **PatchSize** - how big are the patches that will be copied into the generated image* **OverlapSize** - the width of a border around the patch via which we perform the search (borders colors have to match)* **windowStep** - to reduce the amount of self-similar patches, when sampling from the example map, we can ask to only check for patches with a X offset step (that is basically our 'sliding' window step :))* **snapshots** - will save an image per iteration (if False, only save the final image) - needed if you want to make a gif :)* **mirror_hor and mirror_vert** - whether you want the example patches to be mirror veritcally or horizontallyAnd...that's all! Have fun :)<jupyter_code>#PARAMS
exampleMapPath = "imgs/1.jpg"
outputPath = "out/1/"
patchSize = 50 #size of the patch (without the overlap)
overlapSize = 10 #the width of the overlap region
outputSize = [300,300]

pbts = patchBasedTextureSynthesis(exampleMapPath, outputPath, outputSize, patchSize, overlapSize, in_windowStep = 5, in_mirror_hor = True, in_mirror_vert = True, in_shapshots = True)
pbts.resolveAll()<jupyter_output><empty_output><jupyter_text>*Make GIF!*If you chose 'snapshots = True' option, then you can convert the sequence of images into an animated GIF! * **frame_every_X_steps** - sometimes you want your GIF to not include *every* frame, this one allows you to skip X number of frames! (don't worry, it will always end up on the last frame to show the fully resolved image)* **repeat_ending** - specify how many frames the GIF will loop over the final resolved image<jupyter_code>gifOutputPath = "out/outGif.gif"

makeGif(outputPath, gifOutputPath, frame_every_X_steps = 1, repeat_ending = 5)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08261405672009864, 'fraction_numerical': 0.006165228113440197, 'mean_word_length': 5.490666666666667, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '70854', 'license': 'MIT', 'n_tokens_mistral': 712, 'n_tokens_neox': 688, 'n_words': 318, 'path': 'Patch-Based Texture Synthesis.ipynb', 'repo_name': 'nightimer-AU/patch-based-texture-synthesis', 'size': '2442'}