pie-torch
Fast Python implementations of Poisson image editing, using Pytorch and NumPy.
Science Score: 64.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.4%) to scientific vocabulary
Keywords
Repository
Fast Python implementations of Poisson image editing, using Pytorch and NumPy.
Basic Info
Statistics
- Stars: 53
- Watchers: 4
- Forks: 4
- Open Issues: 2
- Releases: 0
Topics
Metadata Files
README.md
PIE-torch: Poisson Image Editing in Pytorch
Fast, n-dimensional Poisson image editing.
2 implementations, including: - using Green Function Convolution, as described in Fast and Optimal Laplacian Solver for Gradient-Domain Image Editing using Green Function Convolution - using a Discrete Sine Transform, following OpenCV's implementation
Recommendations:
- For blending images with consistent boundaries, use blend, the Green Function Convolution implementation.
- For images with inconsistent boundaries, use blend_dst_numpy.
Main interface:
- blend: primary entrypoint, blends source image into target image at specified coordinates.
- blend_dst_numpy: entrypoint for DST-based blending (currently only available in NumPy).
- CachedPoissonBlender: calls blend but caches the Green function, so should be faster if you're repeatedly
blending source patches of equal size, as you will only need to construct the Green function once.
- blend_numpy: A NumPy implementation of blend.
- blend_wide[_numpy]: Wrappers of blend methods which allow for blending over entire image to more smoothly integrate the source region.
Why use it?
- It's faster than any available alternative (OpenCV's seamlessClone, or manual solvers using iterative methods).
- It's flexible, working on n-dimensional images, with no explicit limitations on data types
(unlike seamlessClone, which only operates on 8-bit 3-channel images).
- You using it makes me feel like I'm contributing to the world.
Installation
Using pip
bash
pip install pie-torch
Manually
Clone PIE-torch repository and install the package locally:
bash
git clone https://github.com/matt-baugh/pytorch-poisson-image-editing.git
pip install -e ./pytorch-poisson-image-editing
You can check the installation by running the tests:
bash
cd pytorch-poisson-image-editing/test
pytest
Usage
Example of blending normal images using mixed gradients: ```python from pietorch import blend
target : torch.Tensor = ... # 3 x N x M image to be blended into source : torch.Tensor = ... # 3 x H x W image to be blended mask : torch.Tensor = ... # H x W mask of which pixels from source to be included corner : torch.Tensor = ... # [y, x] coordinate of location in target for source to be blended
result = blend(target, source, mask, corner, True, channels_dim=0) ```
Examples
A wide variety of full examples (including how to create the two below) are given in the examples notebook.
2D mixed gradient comparison with OpenCV's seamlessClone:
Target | Source
:-------------------------:|:-------------------------:
| 
Results:

3D mixed gradient blending over spatial and temporal dimensions:
Target | Source
:-------------------------:|:-------------------------:
| 
Result:

Owner
- Name: Matthew Baugh
- Login: matt-baugh
- Kind: user
- Repositories: 4
- Profile: https://github.com/matt-baugh
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: PIE-torch
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Matthew
family-names: Baugh
email: matthew.baugh17@imperial.ac.uk
affiliation: Imperial College London
orcid: 'https://orcid.org/0000-0001-6252-7658'
repository-code: >-
https://github.com/matt-baugh/pytorch-poisson-image-editing
repository: 'https://pypi.org/project/pie-torch/0.0.1/'
abstract: 'Fast, n-dimensional Poisson image editing.'
keywords:
- pytorch
- numpy
- poisson-image-editing
license: MIT
GitHub Events
Total
- Issues event: 2
- Watch event: 17
- Issue comment event: 2
- Fork event: 1
Last Year
- Issues event: 2
- Watch event: 17
- Issue comment event: 2
- Fork event: 1
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 35
- Total Committers: 2
- Avg Commits per committer: 17.5
- Development Distribution Score (DDS): 0.057
Top Committers
| Name | Commits | |
|---|---|---|
| Matthew Baugh | m****7@i****k | 33 |
| Matthew Baugh | 5****h@u****m | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 7
- Total pull requests: 1
- Average time to close issues: 3 months
- Average time to close pull requests: N/A
- Total issue authors: 7
- Total pull request authors: 1
- Average comments per issue: 2.57
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: 8 months
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 2.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- LonglongaaaGo (1)
- YotamNitzan (1)
- syguan96 (1)
- m-pektas (1)
- Gabriel-Huang (1)
- liangshuang1993 (1)
- conti3000 (1)
Pull Request Authors
- conti3000 (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 76 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 1
- Total maintainers: 1
pypi.org: pie-torch
N-dimensional Poisson image editing implemented with Pytorch and NumPy
- Homepage: https://github.com/matt-baugh/pytorch-poisson-image-editing
- Documentation: https://pie-torch.readthedocs.io/
- License: mit
-
Latest release: 0.0.1
published over 3 years ago
Rankings
Maintainers (1)
Dependencies
- numpy *
- scipy >=1.4
- torch >=1.7