Skip to main content

Fast morphology erosion and dilatation using batch structurant element subdivision.

Project description

[license GPL] [versions] [downloads] [documentation]

Useful links: Binary Installers | Source Repository | Online Documentation |

Description

This module enables efficient morphological erosion and dilatation. It uses the kernel subdivision algorithm implemented in C, with multithreading.

Example of kernel decomposition

Features

  1. Works for any tensor dimension, 2d for images, 3d for videos…

  2. The morphological structuring element decomposition logarithmically reduces temporal complexity.

  3. Functions can be parallelized to take advantage of all the CPU threads, in exchange of higher edge effects.

  4. Functions can be compiled dynamically in C to reduce side-effects and overhead, in exchange for a longer loading time.

Examples

import morphomath, cv2
path = morphomath.utils.get_project_root() / "media" / "image.png"
img = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
dilate = morphomath.Dilatation([[0, 1, 0], [0, 1, 0], [1, 1, 1]]).decomposed()
print(dilate)
cv2.imwrite("result.png", dilate(img))

Before

input

After

result

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

morphomath-0.0.2.tar.gz (64.9 kB view details)

Uploaded Source

File details

Details for the file morphomath-0.0.2.tar.gz.

File metadata

  • Download URL: morphomath-0.0.2.tar.gz
  • Upload date:
  • Size: 64.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for morphomath-0.0.2.tar.gz
Algorithm Hash digest
SHA256 92bd52c73fea375d044ea30149fdd024aa5ba5226afa55973a2e91e3a354030c
MD5 3c4f1bd4e524763a4f066d7c4b875e4e
BLAKE2b-256 03a3e0895cb7671e0e2e90dc381828130f0fb5521adf4607494bb1540180acf3

See more details on using hashes here.

Supported by

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