Skip to main content

Generate print-ready pattern images for DIC applications.

Project description

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)

random speckle

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,
    )

random speckle 2

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)

vertical lines

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)

checkerboard

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speckle_pattern-1.3.2.tar.gz (605.0 kB view details)

Uploaded Source

Built Distribution

speckle_pattern-1.3.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file speckle_pattern-1.3.2.tar.gz.

File metadata

  • Download URL: speckle_pattern-1.3.2.tar.gz
  • Upload date:
  • Size: 605.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for speckle_pattern-1.3.2.tar.gz
Algorithm Hash digest
SHA256 3ebed0886ae3c32ec49c12335d7fef09b418750bf537a2187153412bd0fa54f0
MD5 e27cc7882c9ccea6ad91001bd4a0723a
BLAKE2b-256 7f6c8020df80f9539d1f1e5730e5e842c2ddc6d23af7fcd01fe384aa9877ccda

See more details on using hashes here.

File details

Details for the file speckle_pattern-1.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for speckle_pattern-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8b7821dbd5223d3813d8a8e91ed6c60b0fd8df4e9c92a1492b006cd2f6d40567
MD5 d1b420ba656f3f58e35db9507e5169c1
BLAKE2b-256 dd864ffe6b2cee0d5c17f4a96ade7b2958d7aa9d5f46da04b68e3f603f2e920a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page