Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.venv
**/__pycache__
**/*.pyc
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
**.swp
**.pyc
**.DS_Store
uv.lock
artifacts
build
devel
provision/ansible/.password
.catkin_tools
.venv
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
ROS_DISTRO ?= noetic
PYTHON_VERSION ?= 3.10

.PHONY: build core viame gui postflight follower leader all clean
.PHONY: install build core viame gui postflight follower leader all clean

# Build .venv on top of an activated conda env from environment.yml
install:
@echo "🚀 Creating virtual environment using uv"
@uv venv --system-site-packages --python=$(PYTHON_VERSION)
@uv sync --frozen --no-cache

build:
docker compose build
Expand Down
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,41 @@ KAMERA, or the **K**nowledge-guided Image **A**cquisition **M**anag**ER** and **

## Installation

### Post-processing (native, Windows or Linux)

GDAL and pycolmap come from conda-forge; [uv](https://docs.astral.sh/uv/)
installs the rest into `.venv`. Requires
[conda](https://conda-forge.org/download/).

Linux/macOS:

```bash
git clone https://github.com/Kitware/kamera.git
cd kamera
# For the pure post-processing and generating flight summary, you can install
# the requirements in requirements.txt, or use the provided dockerfile
conda env create -f environment.yml
conda activate kamera
make install
source .venv/bin/activate
```

Windows (PowerShell or Anaconda Prompt):

```powershell
git clone https://github.com/Kitware/kamera.git
cd kamera
conda env create -f environment.yml
conda activate kamera
pip install -e .
```

Afterwards, `conda activate kamera` is all you need. Conda installs the CUDA
build of pycolmap automatically with NVIDIA driver 575+ (CUDA 12.9),
otherwise the CPU build; GPU only matters for full camera model calibration.

### Docker images

```bash
# post-processing / flight summary image
make postflight
# Builds the core docker images for use in the onboard sytems
make nuvo
Expand Down
8 changes: 4 additions & 4 deletions docker/gui.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ RUN mkdir -p /home/user/.config/kamera && \
RUN ln -sv /usr/bin/python3 /usr/bin/python || true
RUN find /home/user -not -user user -execdir chown user {} \+

# Install kamera for wxpython_gui imports (e.g. colmap_processing.camera_models).
# Use --no-deps: base images already provide runtime deps, and a full install
# fails trying to replace distutils-installed PyYAML from ROS/Noetic.
# Install kamera for wxpython_gui imports. --no-deps: deps come from the base
# image (a full install trips on ROS's distutils PyYAML).
# --ignore-requires-python: ROS Noetic pins python 3.8, below our 3.10 floor.
RUN pip install --no-cache-dir matplotlib \
&& pip install --no-cache-dir --no-deps -e $REPO_DIR
&& pip install --no-cache-dir --no-deps --ignore-requires-python -e $REPO_DIR

# use the exec form of run because we need bash syntax
USER user
Expand Down
37 changes: 29 additions & 8 deletions docker/kamerapy.dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
FROM python:3.10.15-bookworm
FROM debian:bookworm-slim

SHELL ["/bin/bash", "-c"]

RUN apt-get update && apt-get install -yq \
libgdal-dev \
python3-gdal \
libgl1-mesa-glx \
curl \
bzip2 \
ca-certificates \
make \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
redis \
dnsutils \
gdal-bin
&& rm -rf /var/lib/apt/lists/*

# Install micromamba
ARG MAMBA_VERSION=2.3.3
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/${MAMBA_VERSION} \
| tar -xvj -C /usr/local/bin --strip-components=1 bin/micromamba
ENV MAMBA_ROOT_PREFIX=/opt/conda

# Conda env supplies python + GDAL + uv; make install layers .venv on top
COPY environment.yml /tmp/environment.yml
RUN micromamba create -y -n kamera -f /tmp/environment.yml \
&& micromamba clean --all -y

RUN pip install --upgrade pip
RUN pip install setuptools==57.0.0
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy

COPY ./ /src/kamera
WORKDIR /src/kamera
RUN pip install -e .

RUN eval "$(micromamba shell hook --shell bash)" \
&& micromamba activate kamera \
&& make install

ENV PATH="/src/kamera/.venv/bin:/opt/conda/envs/kamera/bin:$PATH"

ENTRYPOINT ["bash"]
11 changes: 11 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Binary deps (GDAL, pycolmap) with no reliable cross-platform wheels.
# `make install` layers the rest on top; see README.md for setup.
name: kamera
channels:
- conda-forge
dependencies:
- python=3.10 # must match PYTHON_VERSION in the Makefile
- gdal>=3.10
- pycolmap>=4.0
- pip
- uv
1,421 changes: 0 additions & 1,421 deletions poetry.lock

This file was deleted.

67 changes: 38 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
[tool.poetry]
[project]
name = "kamera"
version = "0.1.0"
description = "KAMERA: Kitware's Image Acquisition ManagER and Archiver"
authors = ["Adam Romlein <adam.romlein@kitware.com>"]
authors = [
{ name = "Adam Romlein", email = "adam.romlein@kitware.com" },
]
license = "Apache-2.0"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"numpy>=2.1.1",
"scipy>=1.14.1",
"matplotlib>=3.9.2",
"opencv-python>=4.10.0.84",
"pillow>=10.4.0",
"pyyaml>=6.0.2",
"datetime>=5.5",
"exifread>=3.0.0",
"pygeodesy>=24.9.29",
"pyshp>=2.3.1",
"simplekml>=1.3.6",
"shapely>=2.0.6",
"transformations>=2024.5.24",
"scriptconfig>=0.8.0",
"ubelt>=1.3.6",
"rich>=13.9.1",
]

[tool.poetry.dependencies]
python = ">=3.8,<4"
numpy = {version = "^2.1.1", markers = "python_version >= '3.10'"}
scipy = {version = "^1.14.1", markers = "python_version >= '3.10'"}
matplotlib = {version = "^3.9.2", markers = "python_version >= '3.10'"}
opencv-python = {version = "^4.10.0.84", markers = "python_version >= '3.10'"}
pillow = {version = "^10.4.0", markers = "python_version >= '3.10'"}
pyyaml = {version = "^6.0.2", markers = "python_version >= '3.10'"}
datetime = {version = "^5.5", markers = "python_version >= '3.10'"}
exifread = {version = "^3.0.0", markers = "python_version >= '3.10'"}
pygeodesy = {version = "^24.9.29", markers = "python_version >= '3.10'"}
pyshp = {version = "^2.3.1", markers = "python_version >= '3.10'"}
simplekml = {version = "^1.3.6", markers = "python_version >= '3.10'"}
shapely = {version = "^2.0.6", markers = "python_version >= '3.10'"}
transformations = {version = "^2024.5.24", markers = "python_version >= '3.9'"}
scriptconfig = {version = "^0.8.0", markers = "python_version >= '3.10'"}
ubelt = {version = "^1.3.6", markers = "python_version >= '3.10'"}
rich = {version = "^13.9.1", markers = "python_version >= '3.10'"}
gdal = [
{ url = "https://github.com/girder/large_image_wheels/raw/wheelhouse/GDAL-3.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=8c150cc85623d136734eb2fad91036933cbb2d6ba58a76095b82ddf53d9bf961", markers = "python_version >= '3.8' and python_version < '3.9'" },
{ url = "https://github.com/girder/large_image_wheels/raw/wheelhouse/GDAL-3.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=7894fddd09d31530d764d5f5e52faafa3585b906c2e49c79fe593af8c6a34c24", markers = "python_version >= '3.9' and python_version < '3.10'" },
{ url = "https://github.com/girder/large_image_wheels/raw/wheelhouse/GDAL-3.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=4a09086631d81808a97c8c7a605aa6230ca045874aa688863cf91794e94880c7", markers = "python_version >= '3.10' and python_version < '3.11'" },
{ url = "https://github.com/girder/large_image_wheels/raw/wheelhouse/GDAL-3.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=aee8c49c3528b8613ad3fe14a9d0066ad6990e143f277aff5be1143f371258a2", markers = "python_version >= '3.11' and python_version < '3.12'" },
{ url = "https://github.com/girder/large_image_wheels/raw/wheelhouse/GDAL-3.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=19cd80ad4bd684e8c7a3f712e5a1c284cce59e5750155f0db0c31d875d3c6321", markers = "python_version >= '3.12' and python_version < '3.13'" },
# GDAL has no reliable cross-platform wheels; it comes from conda-forge
# (environment.yml) and reaches .venv via --system-site-packages.

[dependency-groups]
dev = [
"ipdb>=0.13.13",
]
ipdb = {version = "^0.13.13", markers = "python_version >= '3.10'"}

[tool.uv]
# Build .venv on the conda python, never a uv-managed one, so
# --system-site-packages sees the conda GDAL.
python-preference = "only-system"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["kamera"]
18 changes: 0 additions & 18 deletions requirements.txt

This file was deleted.

9 changes: 0 additions & 9 deletions setup.py

This file was deleted.

Loading
Loading