[−][src]Crate texture_synthesis
texture-synthesis
is a light API for Multiresolution Stochastic Texture Synthesis,
a non-parametric example-based algorithm for image generation.
First, you build a Session
via a SessionBuilder
, which follows the builder pattern. Calling
build
on the SessionBuilder loads all of the input images and checks for various errors.
Session
has a run()
method that takes all of the parameters and inputs added in the session
builder to generated an image, which is returned as a GeneratedImage
.
You can save, stream, or inspect the image from GeneratedImage
.
Features
- Single example generation
- Multi example generation
- Guided synthesis
- Style transfer
- Inpainting
- Tiling textures
Please, refer to the examples folder in the repository for the features usage examples.
Usage
Session follows a "builder pattern" for defining parameters, meaning you chain functions together.
// Create a new session with default parameters let session = texture_synthesis::Session::builder() // Set some parameters .seed(10) .nearest_neighbors(20) // Specify example images .add_example(&"imgs/1.jpg") // Build the session .build().expect("failed to build session"); // Generate a new image let generated_img = session.run(None); // Save the generated image to disk generated_img.save("my_generated_img.jpg").expect("failed to save generated image");
Re-exports
pub use image; |
Structs
Example | An example to be used in texture generation |
ExampleBuilder | A builder for an |
GeneratedImage | An image generated by a |
ProgressStat | Helper struct for passing progress information to external callers |
ProgressUpdate | The current state of the image generator |
Session | Texture synthesis session. |
SessionBuilder | Builds a session by setting parameters and adding input images, calling
|
Enums
ImageSource | Helper type used to pass image data to the Session |
SampleMethod | Method used for sampling an example image. |
SamplingMethod | Internal sample method |
Traits
GeneratorProgress | Allows the generator to update external callers with the current progress of the image synthesis |
Type Definitions
Error |