π Tutorial: Project Your First Image
What you'll learn
In 5 minutes, you'll project a fisheye camera image onto a regular gridβthe core operation of skycam.
Prerequisites
- Python 3.11+
- uv package manager
- Sample calibration files (JP2 format)
Step 1: Install skycam
Step 2: Prepare Your Files
You need two types of files:
- Calibration maps (provided by your camera vendor):
azimuth_visible.jp2β Azimuth angles for each pixel-
zenith_visible.jp2β Zenith angles for each pixel -
Input image β A fisheye camera image (JP2 or JPEG)
Create this structure:
my_project/
βββ calibration/
β βββ azimuth_visible.jp2
β βββ zenith_visible.jp2
βββ input.jp2
βββ project_image.py
Step 3: Write the Projection Script
Create project_image.py:
from pathlib import Path
from skycam.adapters import JP2CalibrationLoader, load_jp2, save_image
from skycam.domain.models import ProjectionSettings
from skycam.domain.projection import ProjectionService
# 1. Load calibration data
loader = JP2CalibrationLoader(Path("calibration"))
calibration = loader.load("visible")
# 2. Create projection service with default settings
settings = ProjectionSettings()
projector = ProjectionService(calibration=calibration, settings=settings)
# 3. Project the image
image = load_jp2(Path("input.jp2"))
projected = projector.project(image)
# 4. Save the result
save_image(projected, Path("output.jpg"))
print("β
Projection complete! Check output.jpg")
Step 4: Run It
You should see:
What Just Happened?
flowchart LR
A[π Fisheye Image] --> B[ProjectionService]
C[π Calibration Maps] --> B
B --> D[π Regular Grid Image]
- Calibration maps define how each pixel in your fisheye image maps to azimuth/zenith angles
- ProjectionService uses bilinear interpolation to sample the fisheye image at grid points
- The output is a regular rectangular grid suitable for analysis