Program to apply random elastic rubbersheet transforms to images for augmenting training sets in machine learning/deep learning.
Project description
imagemorph
This is a Python wrapper of the imagemorph [1] repository, a program to apply random elastic rubbersheet transforms to images for augmenting training sets in machine learning/deep learning.
Rather than running a compiled executable and writing the resulting image to disk as in the original repo, this wrapper performs the same random elastic morphing as in the original repo, but instead returns the resulting image as a numpy array, which can then be used for further processing in, for example, a machine learning pipeline.
Any image type can be processed (not just .ppm), as long as it can be loaded with OpenCV.
How to install
Install using pip:
pip install imagemorph
Example usage
import cv2 as cv
from imagemorph import elastic_morphing
amp, sigma = 0.9, 9
img_name = "img/sample-input.png"
# load image
img = cv.imread(img_name)
h, w, _ = img.shape
# apply random elastic morphing
res = elastic_morphing(img, amp, sigma, h, w)
# write result to disk
cv.imwrite('img/out.png', res)
References
Original Author: Marius Bulacu (.pgm version for characters). Adapted for .ppm and color: Lambert Schomaker.
Please cite:
[1] M Bulacu, A Brink, T van der Zant, L Schomaker (2009). Recognition of handwritten numerical fields in a large single-writer historical collection, 10th International Conference on Document Analysis and Recognition, pp. 808-812, DOI: 10.1109/ICDAR.2009.8
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
File details
Details for the file imagemorph-0.2.tar.gz.
File metadata
- Download URL: imagemorph-0.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66b7652697e60108cffaa81081b1d3c4aa358d24bd25cba74c4f4cea7d505d19
|
|
| MD5 |
af7bc7eeb9b52bb6bc79ac9738836df2
|
|
| BLAKE2b-256 |
933a233563d42c2010eb83d4b62f3d7eb16403c183a51d005c26fef80c8d8f2a
|