Skip to main content

vispek-hc

SDK and command line for the Vispek HC1500 multispectral camera: one USB camera plus 17 switchable LED bands from 255 nm to 1050 nm. A capture is 17 frames taken one after another, one LED at a time.

中文说明

Status

Version 0.1, pre-alpha. Checked on one real HC1500 so far: serial protocol, frames, parameter lock, black level, timing, a scan of LEDs 5-17 and a white reference on white paper, and a scan of all 17 channels including the UV LEDs (see docs/acceptance/). A real reflectance standard has not been tried yet. Everything below runs today on the simulated device that ships with the package (--simulate). Camera parameters can be locked on macOS (verified on the device) and on Linux (built, not verified), not yet on Windows; see docs/platforms.md.

Install

Python 3.11 or newer, and ffmpeg on the PATH to read the camera.

python3 -m venv hc-env && source hc-env/bin/activate
pip install vispek-hc
vispek-hc setup                      # macOS: compiles the camera-control helper, once
vispek-hc check --simulate           # the whole stack on the simulated device

For the command alone, uv tool install vispek-hc or pipx install vispek-hc also work. A plain pip install into the system Python is refused on current Linux and macOS (PEP 668). To work on the code, clone this repository and run uv sync.

A first picture, without hardware

uv run vispek-hc demo -o demo

That scans an invented scene on the simulated device, makes a white reference, computes relative reflectance, writes rgb.png, cir.png, ndvi.png and spectra.csv into demo/, and checks the result against the scene it simulated (PASS). The same, step by step:

uv run vispek-hc record -o sample --simulate              # dark frame + LEDs 5-17
uv run vispek-hc reference white -o white --simulate      # the white board, same settings
uv run vispek-hc calibrate --white white -o calibration
uv run vispek-hc reflectance sample --calib calibration -o cube.npz
uv run vispek-hc view sample --calib calibration --mode ndvi -o ndvi.png

No real sample pictures are distributed with the software.

With a device

uv run vispek-hc check               # what is missing, with a hint for each problem
uv run vispek-hc record -o first     # about 10 s; macOS asks for camera access the first time
uv run vispek-hc view first -o first.png

When nothing is missing, check also lights LED 6 (520 nm, visible) for 0.3 s to confirm that the serial port and the camera belong to the same device; devices --pair runs that probe on its own. The camera is found by itself on all three systems; --camera names another. Add --json to any command for one machine-readable object on stdout (docs/cli.md).

Shortest path
macOS brew install ffmpeg, then vispek-hc setup (compiles the camera-control helper; needs xcode-select --install) to lock camera parameters; check; record. Without the helper, record --unlocked
Linux apt install ffmpeg v4l-utils; sudo usermod -aG dialout $USER and log in again; check; record -o first (built, not verified on a device yet)
Windows winget install ffmpeg; install the CH341 serial driver; allow desktop apps to use the camera; check; record -o first --unlocked (parameter locking is not built yet)

Details and what --unlocked costs you: docs/platforms.md.

What the data looks like

A capture is a folder of lossless frames with capture.json. A cube has the raw frames and one number per pixel and band:

import json, numpy as np

z = np.load("cube.npz", allow_pickle=False)  # written by 'vispek-hc reflectance'
values = z["values"].astype(np.float32)  # (H, W, B), axes Y, X, B
valid = np.isfinite(values) & ((z["mask"] & 7) == 0)
rgb = z["rgb"]  # (H, W, B, 3) uint8 raw code values
band_ids, nm = z["band_ids"].tolist(), z["wavelengths_nm"]
meta = json.loads(str(z["metadata_json"]))

Or in Python from the start:

import vispek_hc

capture = vispek_hc.capture("first-scan", simulate=True)  # drop simulate with hardware
cube = capture.cube()  # .values (H, W, bands), .rgb, .mask, .bands

What the numbers are. Pixel values are 8-bit code values after the camera's own image processing. They are not linear radiance, relative reflectance is an index and not a physical reflectance, and band wavelengths are nominal LED centre wavelengths, not a sensor response. Read docs/calibration.md before you compare two scans.

A viewer

vispek-hc-viewer is a separate package built on this one: a page served to your own computer with the live picture, LED switches, scan and white-reference buttons, band pictures, indices and spectra. It records ordinary capture folders, so the command line and the viewer read each other's data. pip install vispek-hc-viewer.

Documentation

License

Apache-2.0, see LICENSE and NOTICE. Trademarks: TRADEMARKS.md.

Metadata

Release files for vispek-hc 0.1.1

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

Source distribution (sdist)

Source distribution for vispek-hc 0.1.1
File Size Uploaded Provenance
vispek_hc-0.1.1.tar.gz 370.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for vispek-hc 0.1.1
File Interpreter ABI Platform
vispek_hc-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 529.5 kB

Release files / vispek_hc-0.1.1.tar.gz

Download URL vispek_hc-0.1.1.tar.gz
Size 370.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9fb40d7c748d91a9e9c509d2fcc9ad6687eeda099aec3d257bcd8677eabc5ea3
BLAKE2b-256 checksum
How to use checksums
d97bedb42237c40750f8fdd7e4bcf8a6833690ff192b7b1b745b346f7849a218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / vispek_hc-0.1.1-py3-none-any.whl

Download URL vispek_hc-0.1.1-py3-none-any.whl
Size 159.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7f157fdd381e0dfd9d5de3b4adfb297f1a21504b6d12b116ec33703a4df7d4e
BLAKE2b-256 checksum
How to use checksums
ed0322a0e82209772466458331737d3c79bc2593c817b0c083b494539bd68710
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for vispek-hc 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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