`Patchgenerator` is a simple tool to generate array indices, with or without overlap, to create numpy array patches. Only requires python.
Project description
patchgenerator
The patchgenerator is a simple tool to generate array indices, with or without overlap, to create numpy array patches. Only requires python.
Example usage:
from patch_indices.patch_indices import PatchGenerator
patch_generator = PatchGenerator(100, 80, 10, 20, y_overlap=2, x_overlap=3)
for patch in patch_generator:
row_start, cols_start, row_end, cols_end = patch
print("row_start, cols_start, row_end, cols_end", row_start, cols_start, row_end, cols_end)
import numpy as np
from patch_indices.patch_indices import PatchGenerator
np_array = np.ones((100, 80, 3), dtype=np.uint8)
y_size, x_size, z_size = np_array.shape
patch_size_y = 10
patch_size_x = 20
patch_generator = PatchGenerator(y_size, x_size, patch_size_y, patch_size_x, y_overlap=2, x_overlap=3)
for patch in patch_generator:
row_start, cols_start, row_end, cols_end = patch
print("row_start, cols_start, row_end, cols_end", row_start, cols_start, row_end, cols_end)
print(np_array[row_start:row_start + row_end, cols_start:cols_start + cols_end, :].shape)
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
patchgenerator-0.0.4.tar.gz
(4.4 kB
view details)
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 patchgenerator-0.0.4.tar.gz.
File metadata
- Download URL: patchgenerator-0.0.4.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4da5fcaf6b7769acb3901d350a518145622a4555f98417d80cde562abc8673a0
|
|
| MD5 |
e17773f05be95621a981024b7817df39
|
|
| BLAKE2b-256 |
2c788d020a974538c1beb4860c6f48104b2c1d81037c63501e2d338e707d22f7
|
File details
Details for the file patchgenerator-0.0.4-py3-none-any.whl.
File metadata
- Download URL: patchgenerator-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e95b3bc8e658be4acd99ea66dc638dfe259f0d7c7934cb303e52014c453f6264
|
|
| MD5 |
1a003bbe8bad8c5e65edf94bb351019e
|
|
| BLAKE2b-256 |
451fefc1a9b177303167cfe13ff21cec0a62a68faacec0a2640b37c68130a99e
|