Skip to content

Direct USB camera / microscope capture with full-resolution stills #166

Description

@SphaeroX

Is your feature request related to a problem?

Currently, focus stacking with a USB microscope requires a two-step workflow:

  1. Capture images in a separate application (OBS, ToupLite, AMCap, etc.)
  2. Import the image series into ChimpStackr for stacking

This is cumbersome, especially when taking many stacks. More critically, most generic camera apps (like the Windows Camera app) apply heavy JPEG compression, losing detail that stacking algorithms rely on. The built-in Windows camera interface also often limits resolution well below what the sensor can deliver (e.g., a 48MP microscope sensor gets downscaled to 1080p over USB if you're not careful).

Proposed solution

Add a "Capture from camera" mode that:

  • Detects connected UVC cameras (USB Video Class — this covers essentially all USB microscopes, webcams, endoscopes)
  • Provides a live preview in a panel within the GUI
  • Captures full-resolution still frames via the camera's still-image pin (not a scaled video frame grab)
  • Saves as lossless format (PNG, TIFF, or BMP) — bypassing the default MJPEG compression
  • Manual or semi-automated focus bracketing: a button to take N shots with a user-adjustable delay between captures (to allow manual focus adjustment between frames)

Workaround for good resolution over USB

Most UVC cameras expose two separate streams:

  1. Video pin — compressed MJPEG, often limited to 1080p or lower
  2. Still-image pin — can deliver the sensor's native resolution (e.g., 48MP / 8000×6000)

Frameworks like OpenCV's VideoCapture only access the video pin. To get full resolution, you need to use platform-specific APIs:

  • Windows: DirectShow (IAMStreamConfig, IAMCameraControl) or MediaFoundation to request the still pin
  • macOS: AVFoundation with AVCapturePhotoOutput for full-res stills
  • Linux: V4L2 with V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE at native resolution, or libcamera where available

A Python cross-platform approach could use something like python-uvc or wrap platform APIs via ctypes/subprocess. Even a pragmatic first step — letting users configure an external capture command (e.g., ffmpeg -f dshow -video_size 8000x6000 -i video="USB Microscope" -vframes 1 capture_%04d.png) with ChimpStackr triggering it at intervals — would be a huge win.

Use case

USB microscopes for PCB inspection, soldering, coin/insect photography. Typical device: YIZHAN 48MP 4K (AN2030-150X), which appears as a standard UVC device on Windows/macOS/Linux.

Additional context

This would make ChimpStackr the first free, cross-platform, all-in-one microscope stacking solution — a killer feature for the maker/microscopy community.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions