Skip to content
SenamjyaPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

capture

A Raspberry Pi camera server. Originally built for the SirkPlast 2026 project (NTNU) to photograph microplastic filter samples, but usable as a general single-process camera server for any Raspberry Pi + camera module.

A FastAPI server that runs in a single process on the Pi and lets you:

  • view a live preview from the camera
  • take photos that are saved with a timestamp
  • download individual photos, or select several and download them together as a zip

1. Quick install

curl -fsSL https://raw.githubusercontent.com/Senamjya/capture/main/setup.sh | bash

2. Running the server

Navigate to the folder

cd capture/

Option A - run detached with tmux (recommended)

Starts the server in a background tmux session:

./start.sh                # start in the background
./stop.sh                 # stop it
tmux attach -t capture    # watch it live (Ctrl-b then d to detach)

Option B - run in the foreground

Handy for quick testing; stops when you close the terminal:

uv run uvicorn app:app --host 0.0.0.0 --port 8080

From a device connected to the same network navigate to the network address in your browser.

Replace all the x values with the output of the hostname -I command:

http://xxx.xxx.xx.xxx:8080/

Config

Variable Default Description
CAPTURE_DIR captures Folder where photos are saved
CAPTURE_WIDTH 4056 Width of saved photos (full sensor resolution)
CAPTURE_HEIGHT 3040 Height of saved photos (full sensor resolution)
PREVIEW_WIDTH 1920 Width of the live preview (lores stream)
PREVIEW_HEIGHT 1080 Height of the live preview (lores stream)
THUMB_SIZE 640 Longest edge (px) of gallery thumbnails
THUMB_QUALITY 80 JPEG quality of thumbnails (1–95)
FRAMERATE 50 Frames per second in the stream
HFLIP 1 Flip horizontally (0/1)
VFLIP 1 Flip vertically (0/1)

API

Route Method Description
/ GET Web page with preview, capture and gallery
/stream GET Live MJPEG preview
/capture POST Take a photo
/api/images GET JSON list of all photos
/images/{name} GET View one photo (full resolution)
/thumbs/{name} GET View thumbnail (640px, cached in the browser)
/download/{name} GET Download one photo
/download-zip POST Download several photos together ({"names": [...]})

License

Copyright 2026 Norwegian University of Science and Technology (NTNU).

Licensed under the Apache License, Version 2.0. See LICENSE for details and NOTICE for attribution.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages