Skip to main content

Landpy

Image, landmark and heat-map flows for small augmented-reality experiments.

Landpy brings an old experiment to a usable stopping point: crop an image, transform its landmarks, build a mask, apply a filter, and carry the edit back to the original canvas. It includes reversible geometry, exact checkpoints, optional debugging, and wrappers for the project's face models.

pip install landpy
# Optional face-model support (Python 3.10–3.13):
pip install 'landpy[tensorflow]'

Python 3.10+ is required for the core package. No weights are downloaded and TensorFlow is not imported when you import landpy. Use a CPU runtime; a GPU is not required. OpenCV is installed as the headless build for notebooks and servers; don't install both OpenCV wheel variants in the same environment.

A first edit

import numpy as np
from landpy import ImageLand, SquareMarks, Filter

image = ImageLand(np.full((120, 180, 3), 180, dtype=np.uint8))
region = SquareMarks.relative(.2, .8, .25, .75, shape=image.shape)
image.make_checkpoint()
image.zoom(region, save_trace=True)
image.implant_filter(Filter('#d52e65', ratio=.5))
image.retrace()  # put the edited crop back into the original image
image.show()
image.undo()     # restore the exact original snapshot

Shapes are (height, width) and points are pixel (row, column) coordinates. RGB arrays use [0, 255] for integers or [0, 1] for floats. Methods usually mutate and return the same container; copy() and + produce independent objects. get_image(), get_marks() and get_heat() expose mutable arrays.

Learn step by step

The eight numbered tutorials contain saved outputs and checks. Each has an Open in Colab link; no separate notebook hosting account is needed to open them. Start with 1. Images and coordinates.

Class Purpose
Land Inverse stack and independent checkpoint history
ImageLand RGB/RGBA images, crops, rotations, resizing and compositing
MarksLand Pixel landmarks, set operations, polygon masks
SquareMarks Axis-aligned rectangles, despite the historical name
QuadMarks Convex quadrilaterals and perspective regions
DualMarks Directed two-point vectors
HeatLand Floating-point masks and heat algebra
Filter Mask-weighted color blending or a custom function
Debugger Categorized timing logs and visual snapshots

Use Python's help(ImageLand.zoom) or the API guide for details.

History has two meanings

save_trace=True records a transform's inverse. retrace() applies that inverse to the current data, which lets an edited crop return to its old position. Image rotation/resizing inverses are approximate: resampling cannot recover discarded pixels. Crop inverses preserve the surrounding saved canvas.

make_checkpoint() saves an exact copy before an edit. undo() restores that snapshot; redo() restores the edited state. New operations invalidate redo. Empty histories raise IndexError. Array writes through mutable getters bypass operation tracking; checkpoint before them and don't rely on automatic redo invalidation for direct writes.

Face models

from landpy import ImageLand
from landpy.pretrained_models import FaceTracker, FaceLandmarksDetector

photo = ImageLand('portrait.jpg')
faces = FaceTracker().detect_faces(photo, threshold=.5, top_k=1)
if faces:
    crop = photo.copy().zoom(faces[0].face_box.copy().expand(1.25))
    marks, presence = FaceLandmarksDetector().detect_face_landmarks(crop)
    (crop + marks).show()

The default mesh is the compatible 478-point MediaPipe Face Mesh V2 asset; legacy 468-point weights remain supported with model_path=.... Model files are pinned to a verified companion repository revision. Downloads go to ~/.cache/landpy/models; set LANDPY_MODEL_DIR to change it. Each detector accepts model_path, cache_dir and sha256 keyword arguments. See model contracts and provenance, especially the incomplete provenance of the original segmentation and expression weights.

FaceTracker detects still images independently; it does not perform temporal tracking. This is an experimental face-effects toolkit, not an accuracy or latency claim. The core package contains no bundled weights or photos.

Development

python -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev,tensorflow]'
python -m pytest
LANDPY_RUN_MODELS=1 python -m pytest -m integration
python scripts/execute_notebooks.py
python -m ruff check landpy tests scripts
python -m build
python -m twine check dist/*

Contributing · Migration and release notes · Release procedure · Original design audit

Code is MIT licensed. Third-party weights and the original example photo have separate provenance; see the model and asset documentation.

Metadata

Release files for landpy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for landpy 0.1.0
File Size Uploaded Provenance
landpy-0.1.0.tar.gz 1.3 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for landpy 0.1.0
File Interpreter ABI Platform
landpy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / landpy-0.1.0.tar.gz

Download URL landpy-0.1.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
e1938de77752818507aa750c087c85ab97fd0a8805a094c6c9ed9f086aa33380
BLAKE2b-256 checksum
How to use checksums
7c7796bdd553cdd78e7938510189c6f5dfd81c088e60bc7a8d45ca7c83835546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / landpy-0.1.0-py3-none-any.whl

Download URL landpy-0.1.0-py3-none-any.whl
Size 34.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86342eac03a24b7e528117db036035c2ab4885252f088e74c48fda2ef4977d8b
BLAKE2b-256 checksum
How to use checksums
6a7c0dc54df344a85c669745492be637cb0597e57aa0cd1e0d96c72be0cb43cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for landpy 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for landpy-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page