haralick-torch
GPU-accelerated Haralick texture extraction for GeoTIFF images using PyTorch.
Installation
GDAL must be installed via precompiled wheels:
https://github.com/cgohlke/geospatial-wheels/releases
pip install GDAL-3.10.1-cp310-cp310-win_amd64.whl
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install haralick-torch
Usage CLI
haralick-torch --input image.tif --out-texture textures.tif --out-pca pca.tif --nir-idx 8 --window 7 --levels 128 --tile 64
Usage API
import torch
from haralick_torch.io import read_nir_as_tensor, write_haralick_geotiff
from haralick_torch.haralick import compute_haralick
from haralick_torch.tiling import process_in_tiles
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
# ---- INPUT
img = "image.tif"
out = "haralick.tif"
nir_band = 4
# ---- IO
nir, ref_ds = read_nir_as_tensor(img, nir_band, DEVICE)
# ---- HARALICK
textures = process_in_tiles(
nir,
compute_haralick,
window=11,
stride=1
)
# ---- SAVE
write_haralick_geotiff(
out,
textures,
list(textures.keys()),
ref_ds
)
Release files for haralick-torch 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| haralick_torch-1.1.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| haralick_torch-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / haralick_torch-1.1.0.tar.gz
| Download URL | haralick_torch-1.1.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5a4eb2c59c876348dbe83c8ffe8d18be20f77fe2b51d91b4d96e35300dc6816
|
|
BLAKE2b-256 checksum How to use checksums |
37fb54cd5b0f8a86fe36667b845bc3ddb47b7c0b9daa9eaee92ff544ee8fc744
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / haralick_torch-1.1.0-py3-none-any.whl
| Download URL | haralick_torch-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
787952dc5e5ad041fdda42bf29ceae66c0bea83c0abfcc04d81f17b6ee41d9b8
|
|
BLAKE2b-256 checksum How to use checksums |
7a651458c67c84d7551fc0c23cde5356442b47d21011f3b4982d7d1f41725caa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|