Skip to main content

Methods for spatial alignment of satellite imagery

Project description

A Python package for efficient multi-temporal image co-registration 🚀

PyPI License Black isort


GitHub: https://github.com/IPL-UV/satalign 🌐

PyPI: https://pypi.org/project/satalign/ 🛠️


Overview 📊

Satalign is a Python package designed for efficient multi-temporal image co-registration. It enables aligning temporal data cubes with reference images using advanced techniques such as Phase Cross-Correlation (PCC), Enhanced Cross-Correlation (ECC), and Local Features Matching (LGM). This package facilitates the manipulation and processing of large volumes of Earth observation data efficiently.

Key features ✨

  • Advanced alignment algorithms: Leverages ECC, PCC, and LGM to accurately align multi-temporal images. 🔍
  • Efficient data cube management: Processes large data cubes with memory and processing optimizations. 🧩
  • Support for local feature models: Utilizes models like SuperPoint, SIFT, and more for keypoint matching. 🖥️
  • Parallelization: Executes alignment processes across multiple cores for faster processing. 🚀

Installation ⚙️

Install the latest version from PyPI:

pip install satalign

How to use 🛠️

Align an ee.ImageCollection with satalign.PCC 🌍

import fastcubo
import ee
import satalign

ee.Initialize(opt_url="https://earthengine-highvolume.googleapis.com")

# Download an image collection
table = fastcubo.query_getPixels_imagecollection(
    point=(-75.71260, -14.18835),
    collection="COPERNICUS/S2_HARMONIZED",
    bands=["B2", "B3", "B4", "B8"],
    data_range=["2018-01-01", "2024-12-31"],
    edge_size=256, 
    resolution=10, 
)

fastcubo.getPixels(table, nworkers=10, output_path="output/aligned_images/s2")

# Create the data cube
s2_datacube = satalign.utils.create_array("output/aligned_images/s2", "output/datacube_pcc.pickle")

# Define the reference image
reference_image = s2_datacube.sel(time=s2_datacube.time > "2024-01-03").mean("time")

# Initialize the PCC model
pcc_model = satalign.PCC(
    datacube=s2_datacube, # T x C x H x W
    reference=reference_image, # C x H x W
    channel="mean",
    crop_center=128,
    num_threads=2,
)

# Run the alignment on multiple cores
aligned_cube, warp_matrices = pcc_model.run_multicore()

Align an Image Collection with satalign.ECC 📚

import fastcubo
import ee
import satalign

ee.Initialize(opt_url="https://earthengine-highvolume.googleapis.com")

# Download an image collection
table = fastcubo.query_getPixels_imagecollection(
    point=(51.079225, 10.452173),
    collection="COPERNICUS/S2_HARMONIZED",
    bands=["B4", "B3", "B2"],
    data_range=["2016-06-01", "2017-07-01"],
    edge_size=128,
    resolution=10,
)

fastcubo.getPixels(table, nworkers=4, output_path="output/aligned_images/ecc")

# Create the data cube
s2_datacube = satalign.utils.create_array("output/aligned_images/ecc", "output/datacube_ecc.pickle")

# Define the reference image
reference_image = s2_datacube.isel(time=0)

# Initialize the ECC model
ecc_model = satalign.ECC(
    datacube=s2_datacube, 
    reference=reference_image,
    gauss_kernel_size=3,
)

# Run the alignment
aligned_cube, warp_matrices = ecc_model.run()

Align using Local Features with satalign.LGM 🧮

import fastcubo
import ee
import satalign

ee.Initialize(opt_url="https://earthengine-highvolume.googleapis.com")

# Download an image collection
table = fastcubo.query_getPixels_imagecollection(
    point=(-76.5, -9.5),
    collection="NASA/NASADEM_HGT/001",
    bands=["elevation"],
    edge_size=128,
    resolution=90
)

fastcubo.getPixels(table, nworkers=4, output_path="output/aligned_images/lgm")

# Create the data cube
datacube = satalign.utils.create_array("output/aligned_images/lgm", "output/datacube_lgm.pickle")

# Define the reference image
reference_image = datacube.isel(time=0)

# Initialize the LGM model
lgm_model = satalign.LGM(
    datacube=datacube, 
    reference=reference_image, 
    feature_model="superpoint",
    matcher_model="lightglue",
)

# Run the alignment
aligned_cube, warp_matrices = lgm_model.run()

In this document, we presented three different examples of how to use SatAlign with PCC, ECC, and LGM for multi-temporal image co-registration. Each example shows how to download an image collection from Google Earth Engine, create a data cube, and align the images using one of the three methods provided by the SatAlign package.

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

satalign-0.1.6.tar.gz (38.8 kB view details)

Uploaded Source

Built Distribution

satalign-0.1.6-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

File details

Details for the file satalign-0.1.6.tar.gz.

File metadata

  • Download URL: satalign-0.1.6.tar.gz
  • Upload date:
  • Size: 38.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/7.0.1 keyring/24.3.1 pkginfo/1.9.6 readme-renderer/34.0 requests-toolbelt/1.0.0 requests/2.32.3 rfc3986/1.5.0 tqdm/4.66.1 urllib3/2.2.1 CPython/3.10.12

File hashes

Hashes for satalign-0.1.6.tar.gz
Algorithm Hash digest
SHA256 8d4fc837fb057a0463072fb03a2fa97058d83028a3c2107f58bae6bdb88a69cf
MD5 db5f4e6f6b71c4cbf00d78a2c44f6f82
BLAKE2b-256 d76cf8c0327c251a76ff25ebb8f8f20cca13831c146c36be698be41cff9a8e76

See more details on using hashes here.

File details

Details for the file satalign-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: satalign-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 42.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/7.0.1 keyring/24.3.1 pkginfo/1.9.6 readme-renderer/34.0 requests-toolbelt/1.0.0 requests/2.32.3 rfc3986/1.5.0 tqdm/4.66.1 urllib3/2.2.1 CPython/3.10.12

File hashes

Hashes for satalign-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f3771b923152ae62424a258da9db7f443cbdcb68421edb40dd51b941422f60b9
MD5 c12bf35cd42fb2ee5b13643709037ca6
BLAKE2b-256 a450d3e2eba5874be9225d43f93005c81fec8ba90c1b6a21a51ea92c2e464731

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