A library that splits the image into overlapping or non-overlapping patches with the optimal step in order to minimize pixels loss. It can then merge them back together.
Project description
image2patch
image2patch splits the image in different patches with automatic detection of the best step in order to minimize pixels loss. The overlap between patches depends on the patch size.
Alternatively, it is possible to choose the step size.
The reconstruction of the original image is possible using patch2image which can merge the patches taking into account the overlap percentage among patches. Hence, the original image is perfectly restored.
If there is a minimum pixels loss during patching procedure, resize to its original dimensions is possible.
Example
Installation
pip install image2patch
from image2patch import image2patch
from image2patch import patch2image
How to use it
image2patch(image, patch_size, step=None, verbose=False)
In particular:
- image : 2D input image
- patch_size : dimension of the window
- step : the distance from one step to another, if =None it will be automatically detected in order to avoid pixels loss. If set = patch_size it will provide patches without overlapping but with pixels loss depending on the size of the input image.
- verbose : if =True it provides details.
patch2image(patched_image, original_dims, step, resize_flag = True)
In particular:
- patched_image : 2D input patches from image2patch
- original_dims : dimension of the original image
- step : step obtained from
image2patch - resize_flag : allows to resize the image to its original dimension in case of pixels loss.
Licence
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image2patch-0.1.1.tar.gz.
File metadata
- Download URL: image2patch-0.1.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d5d0fcec807c84f5315e25f08c994f63fb2d5a30b76c5571705397f252f1f87
|
|
| MD5 |
3738081491d62e30be4b97410cfdd047
|
|
| BLAKE2b-256 |
b32620c7b534c47dc53ddd4bbe3f20e38f754f36b1bcf71473cfbc28ae3aa63e
|
File details
Details for the file image2patch-0.1.1-py3-none-any.whl.
File metadata
- Download URL: image2patch-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6934ba57b87ec6c0fff5e1639cce71dcf808d5829551fe50fc73f2c3081d2b3
|
|
| MD5 |
fa146b106e064de01e34204191316661
|
|
| BLAKE2b-256 |
ddcf86419abace2540f856d5022ef06ef7af7d629c5685c82e5c26a75fe2882b
|