diptorch
Install
pip install diptorch
Hello, World!
import matplotlib.pyplot as plt
from diptorch.filters import gaussian_filter
from diptorch.utils import astronaut, imshow
# Zero-th order Gaussian filter (smoothing)
img = astronaut()
img_filtered = gaussian_filter(img, sigma=2.5)
imshow(img, img_filtered)
plt.show()
# First-order Gaussian filter
img = astronaut()
img_filtered = gaussian_filter(img, sigma=2.5, order=1)
imshow(img, img_filtered)
plt.show()
# Second-order Gaussian filter on the height dimension (y-axis)
img = astronaut()
img_filtered = gaussian_filter(img, sigma=2.5, order=[2, 0])
imshow(img, img_filtered)
plt.show()
Hessian matrix
from diptorch.filters import hessian, hessian_eigenvalues
from einops import rearrange
# Hessian matrix of an image (all second-order partial derivatives)
img = astronaut()
H = hessian(img, sigma=2.5, as_matrix=True)
H = rearrange(H, "B C1 C2 H W -> B (C1 H) (C2 W)").squeeze()
plt.imshow(H, cmap="gray")
plt.axis("off")
plt.show()
# Eigenvalues of the Hessian matrix of an image
# sorted by the magnitude of the eigenvalues
img = astronaut()
eig = hessian_eigenvalues(img, sigma=2.5)
_, axs = imshow(img, *eig.split(1, 1))
axs[1].set(title="Smallest magnitude\neigenvalue")
axs[2].set(title="Largest magnitude\neigenvalue")
plt.show()
Metadata
Release files for diptorch 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| diptorch-0.0.1.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| diptorch-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.5 kB
Release files / diptorch-0.0.1.tar.gz
| Download URL | diptorch-0.0.1.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01cb823e7ef783577c245e3d1bde8a5a4dbcc6b51becd5f60a350ed039124937
|
|
BLAKE2b-256 checksum How to use checksums |
56bbbe27f171e96c61655c7ef087169672949a2a814426b06f7f97df2127a081
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / diptorch-0.0.1-py3-none-any.whl
| Download URL | diptorch-0.0.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c03e51d076f594e49170c4f79265ed324afffb0ec888547937c16c9151384b3
|
|
BLAKE2b-256 checksum How to use checksums |
13d492cc1bc39a51652f61099534f372ba6b32bec87c1b1529f30d7373c3c9d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|