Generate print-ready images of a random speckle pattern for DIC applications.
Installation
This package is hosted on PyPI. Install it using pip:
pip install speckle_pattern
Example speckle pattern
from speckle_pattern import generate_and_save
image_height = 50 # mm
image_width = 100 # mm
speckle_diameter = 3 # mm
dpi = 200
save_path = 'example.jpg'
generate_and_save(image_height, image_width, dpi, speckle_diameter, save_path)
More speckle generation options
from speckle_pattern import generate_and_save
image_height = 50 # mm
image_width = 100 # mm
speckle_diameter = 7.5 # mm
dpi = 150
save_path = 'example2.tiff'
size_randomness = 0.9 # set higher for more speckle size variety
position_randomness = 2.5 # set higher for more speckle position variety
speckle_blur = 0. # sigma of smothing Gaussian kernel
grid_step = 2. # approximate grid step, in terms of speckle diameter `D`
generate_and_save(
image_height,
image_width,
dpi,
speckle_diameter,
save_path,
size_randomness=size_randomness,
position_randomness=position_randomness,
speckle_blur=speckle_blur,
grid_step=grid_step,
)
Example line pattern
from speckle_pattern import generate_lines
image_height = 50 # mm
image_width = 100 # mm
line_width = 5 # mm
orientation = 'vertical'
dpi = 200
save_path = f'example_lines_{orientation}.jpg'
generate_lines(image_height, image_width, dpi, line_width, save_path)
Example checkerboard pattern
from speckle_pattern import generate_checkerboard
image_height = 50 # mm
image_width = 100 # mm
line_width = 4 # mm
dpi = 200
save_path = f'example_checkerboard.jpg'
generate_checkerboard(image_height, image_width, dpi, line_width=line_width, path=save_path)
Authors
Metadata
Release files for speckle-pattern 1.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| speckle_pattern-1.3.4.tar.gz | 673.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| speckle_pattern-1.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 679.5 kB
Release files / speckle_pattern-1.3.4.tar.gz
| Download URL | speckle_pattern-1.3.4.tar.gz |
|---|---|
| Size | 673.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b99f4e5e96a936b681cc6a9f17bb160a77b8fa1c0b3d7fe73ee6b7e4e6b9da63
|
|
BLAKE2b-256 checksum How to use checksums |
ff385022920c1209a99ab4a493056250ee47bef0e7adf15f941cd1bcc7a0cf81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / speckle_pattern-1.3.4-py3-none-any.whl
| Download URL | speckle_pattern-1.3.4-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27f3d8e2fd281ea266d0fcd7e3db65b3cbd87d1b47612eff1d5e5640e89fb5d0
|
|
BLAKE2b-256 checksum How to use checksums |
76926c58540fab5b9f1c8222a393be22ef149a33edfbf8706dbca415f77c1d3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|