Orders and payments are tests (nothing charged or shipped)

DeveloperGet started

Quickstart

From a camera on your desk to a left and a right image in your own code. Every step here has been run against the camera. Opening, reading and the left/right split: verified with the published 0.0.7 wheel (Rust implementation) ①. The writes in steps 5 and 6: measured with the earlier Python implementation; with the Rust implementation (the published 0.0.11 wheel, one unit, Windows 11, 2026-12-03) they were written and read back as written, not counted as verified, but step 6 as shown — 96 over 0 in an open camera — did not change the image in that open (a later open was lit).

This walkthrough covers capture, camera controls and the IR illuminator. Installing a calibration file is a preview, described on Install; rectification and depth are not in the package.

First run, in six steps

  1. 1

    Install

    pip install opticmix-vision — step 2. Step 2

  2. 2

    Check the picture before you write code

    Open the camera in the viewer: python -m opticmix_vision.viewer. The viewer shows the picture; its live-camera path has not been signed off yet. With no camera, python -m opticmix_vision.viewer --synthetic shows generated frames: the window, keys and saving run, the camera's own capture path does not. Use 0.0.5 or newer: with 0.0.4, upgrade first with pip install --upgrade opticmix-vision (see “The viewer in 0.0.4” under When it does not work). Code samples · When it does not work

  3. 3

    First code

    Tell the SDK how the frame is packed, open the camera and read a frame — steps 3 and 4. Step 3

  4. 4

    Save

    Write the left and right images to PNG files — the end of step 4. Step 4

  5. 5

    Controls

    Pin the exposure and turn on the IR flood — steps 5 and 6. Step 5

  6. 6

    Next

    The examples in the repository, and the API reference. Code samples · API reference

1. Plug it in and find it

The camera enumerates as a standard UVC video device — no driver install. It reports no USB serial number, so the operating system cannot tell two units apart. Using two units on one computer has not been tested — connect one at a time.

2. Install the SDK

Two dependencies. On Windows x64, no build step. To upgrade an earlier version, use pip install --upgrade opticmix-vision.

shell
pip install opticmix-vision

3. Tell the SDK how the frame is packed

Both eyes arrive inside one frame, and nothing in the stream says how they are arranged. The SDK has no default for this on purpose. For the Weevia S1, DeviceConfig.weevia_s1() finds the camera by name and fills in what was measured on it: the frame is side by side and the first half is the right eye (measured on one unit). For any other camera you pass the layout and the left/right order explicitly. Get the order wrong and your depth work silently mirrors, so confirm it once with “Checking the left/right order” below. Finding the camera by name: verified with the published 0.0.5 wheel (one unit, Windows 11, 2026-11-24); refusing two cameras of the same name: not run. Which half is the left eye: verified ① — covering one lens at a time removed the scene from the SDK eye of the same name.

Checking the left/right order

  1. DeviceConfig.weevia_s1() uses lr_order="first_is_right", measured on one unit.
  2. If left and right look swapped, pass the other order: DeviceConfig.weevia_s1(lr_order="first_is_left").
python
from opticmix_vision import DeviceConfig

# Finds the Weevia S1 by name and fills in what was measured on it:
# side by side, first half is the right eye, 1600x800 MJPG at 90 fps.
cfg = DeviceConfig.weevia_s1()

# Any other camera: layout and lr_order have no defaults — the SDK will not guess them.
# cfg = DeviceConfig(
#     layout="sbs", lr_order="first_is_right",
#     device=1, backend="dshow",          # an OpenCV index; it shifts when cameras are plugged in
#     width=1600, height=800,             # a request — read cam.mode for what you got
#     fps=90, fourcc="MJPG",              # without MJPG the stream has run at 9.3 fps
# )

4. Open the camera and read a frame

The device is opened here and left open, because steps 5 and 6 use it; step 6 closes it. In your own script, wrap it in a with block instead (see the last step) and it closes by itself. Reading returns a left image, a right image, a host timestamp and a frame index. A failed read raises rather than returning an empty frame. Check the negotiated mode — the driver may not give you what you asked for.

python
from opticmix_vision import Device

cam = Device(cfg).open()      # stays open for steps 5 and 6; closed at the end of step 6
print(cam.mode.to_dict())     # what the driver actually negotiated

frame = cam.read()            # raises on failure, never returns empty
print(frame.size)             # (width, height) of a single eye
print(frame.host_ns, frame.index)

left, right = frame.left, frame.right   # each (h, w) uint8

import cv2
cv2.imwrite("left.png", left)     # open the two files to see what the camera sees
cv2.imwrite("right.png", right)

5. Pin the exposure

Set a fixed short exposure through the standard UVC property, either at open time or later on a live device. The exposure number is a driver-scale value, not microseconds — the mapping to real time has not been measured. Read the value back after you set it. Measured with the earlier Python implementation. With the Rust implementation (the published 0.0.11 wheel; one unit, Windows 11, 2026-12-03), exposure, gain and the illuminator were written and read back as written; of these, only the illuminator's effect on the image was measured again (once).

python
# on the open device from step 4
cam.set_prop("CAP_PROP_EXPOSURE", -5)        # driver-scale value, not microseconds
print(cam.get_prop("CAP_PROP_EXPOSURE"))     # read it back after you set it

# or set it when the device opens, for your next run:
# cfg = cfg.replace(extra_props={"CAP_PROP_EXPOSURE": -5})

print(cam.controls.get("auto_exposure"))     # 'manual' or 'auto'

6. Turn on the IR flood

The illuminator is driven through a standard UVC control. Writing a value returns the driver's readback — which confirms the driver accepted it, not that the light actually changed. Check the image to confirm, as the code below does. Measured with the earlier Python implementation. With the Rust implementation (the published 0.0.11 wheel; one unit, Windows 11, one open, 2026-12-03): 24, 16 and 0 read back as written, 24 lit part of the scene and 16 next to none; 96 written over 0 read back 96 but the image did not change in that open (a later open was lit). Turning the illuminator on from 0 in an open camera was not shown: 96 written over 0 read back 96 and the image did not change in that open (a later open was lit).

python
from opticmix_vision import LedControl

led = LedControl(cam)
print(led.get())          # current raw value; 0-16 is off
off = cam.read().left     # a frame before the illuminator goes on (if it printed 0-16)
led.set(96)               # ceiling is 96, light starts at 24

# The readback is not proof the light changed. Check the image: after about
# half a second, count the pixels more than 10 DN brighter than the off frame.
for _ in range(45):
    on = cam.read().left
print(((on.astype(int) - off.astype(int)) > 10).sum())   # 0 means nothing lit up

cam.close()               # done — release the camera

7. The whole thing in one file

Steps 3 to 6 as a single script. The with block opens the camera and closes it when the block ends, even if a line inside raises. Opening, reading and the left/right split: verified with the published 0.0.7 wheel (Rust implementation) ①. The writes in steps 5 and 6: measured with the earlier Python implementation; with the Rust implementation (the published 0.0.11 wheel, one unit, Windows 11, 2026-12-03) they were written and read back as written, not counted as verified, but step 6 as shown — 96 over 0 in an open camera — did not change the image in that open (a later open was lit).

python
from opticmix_vision import Device, DeviceConfig, LedControl

with Device(DeviceConfig.weevia_s1()) as cam:                  # closes the camera when the block ends
    print(cam.mode.to_dict())
    cam.set_prop("CAP_PROP_EXPOSURE", -5)

    led = LedControl(cam)
    led.set(96)

    frame = cam.read()
    print(frame.size, frame.left.mean(), frame.right.mean())

When it does not work

Before you open an issue

What to paste into an issue
Run python -m opticmix_vision.doctor and paste its output into the issue: OS, Python, SDK and OpenCV versions, the video devices, each camera's USB details (VID:PID, USB device revision, link speed) and the installed calibration — without opening the camera. python -m opticmix_vision.doctor --open also opens it and adds the mode, 3 s of frame timing, stalled eyes and every control's value and range; it writes no control. doctor --open (its report includes everything the doctor prints without --open): verified ①; on Linux verified on one setup only (one Weevia S1 unit, Ubuntu 26.04.1, x86_64, USB connected directly, the published 0.0.10 wheel and crate, two USB re-insert cycles, 2026-12-02). The doctor is in 0.0.5 and newer.
Open a bug report on GitHub

Install

pip finds no version, or tries to build
Python older than 3.10: pip finds no version (3.10 or newer is required). Otherwise, when no wheel fits — Windows without x64 Python, Linux other than x86_64 with glibc 2.17 or newer — pip tries to build from source (see Install).
“ControlsUnavailable: opticmix_vision._core (the compiled extension) is not installed”
The package was imported without its compiled extension, as from a source checkout. Frames can still be read, but finding the camera by name on Windows, the camera controls and reading a calibration file cannot. Install the wheel — pip install opticmix-vision — instead of using a checkout on its own.

Camera does not open, or the video

One eye goes black or stops moving
Unplug the USB cable and plug it back in. On the units we have tested, one eye's stream has occasionally stopped. read() raises DeviceError naming the eye once it has sent the same image 90 frames in a row. Turn the check off with DeviceConfig.weevia_s1(stall_frames=0). Measured with the earlier Python implementation; this check has not been verified with the camera through the Rust implementation (since 0.0.3). The check needs 90 frames: a shorter capture can end without an error with one eye black, or both. Seen on one unit and one PC: on 2026-11-25 (the published 0.0.7 wheel), on the third and fourth opens after a USB re-insertion, two 0.6 s recordings made with examples/record_video.py (48 and 33 frames) had the left eye at 0 in every pixel from the first frame; on 2026-11-26 (the published 0.0.8 wheel), on the third open after a USB re-insertion, a 10 s recording made with examples/record_video.py had 11 frames, about one a second, with both eyes at 0 in every pixel from the second frame — the example exited normally and raised no error. The cause has not been established. Look at both eyes and the arrival rate of a recording before relying on it.
The frame rate is far below 90
Check that the mode is MJPG (cam.mode).
The error says the Weevia S1 was not found
The message lists the cameras Windows reported. Re-insert the cable. If the camera is missing from that list, Windows does not see it either. On Linux the message lists the video nodes it found; you can also pass device="/dev/videoN" — see Linux on Downloads.
Two Weevia S1 are connected
Finding the camera by name stops (the camera reports no USB serial number); the error begins “Weevia S1 ... not found” and ends with the two USB locations (where they cannot be read, ['WN Dual Camera', 'WN Dual Camera']; on Linux, their /dev/video paths). Open one by its USB location — DeviceConfig.weevia_s1(usb_location="..."), with a location python examples/list_devices.py prints — or connect one at a time. A USB location is the port, not a serial number: it changes when the camera moves to another port. Using two cameras at the same time is not supported. Picking by USB location: run with the camera once, with one camera connected (one PC, 2026-11-25, the 0.0.6 code); not run with two cameras. The viewer, the explorer, doctor --open, presets save and load, and calib check take it as --usb-location (0.0.7; they read and write that camera's controls): run without a camera only.
Which USB port
Connect to a USB 3 port directly. The figures in this hub whose USB link was recorded were measured over SuperSpeed; USB 2 is not qualified.
“failed to open the camera: device=… backend=… (unplugged, wrong index, or in use by another app?)”
OpenCV could not open the device named in the message; the SDK cannot tell which of the three it was. Check the cable, the device you passed, and any other program that may have the camera open — close it and try again.
“frame read failed (timeout or camera unplugged)”
read() raises this when OpenCV returns no image. Check that the camera is still connected, then open it again.
Left and right look swapped
lr_order decides which half of the frame is the left eye; DeviceConfig.weevia_s1() uses first_is_right, measured on one unit. Check the order with “Checking the left/right order” (Quickstart step 3) and pass the matching lr_order (DeviceConfig.weevia_s1(lr_order=...) takes it too).
Checking the left/right order
The split raises or the halves differ in size
The layout does not match the stream. Confirm the negotiated mode and the packing before anything else.
The viewer in 0.0.4
Upgrade to 0.0.5 or newer: pip install --upgrade opticmix-vision. The 0.0.4 viewer read the LED, exposure and gain from the camera on every frame to draw them. On the one camera tested (once, through a USB hub), reading these three values on every frame was followed by the stall check reporting the left eye (the right eye was not checked) in 2 of 2 test-script runs, while 300 frames read without them in the same session streamed normally. Whether the reads cause it is not established. The 0.0.5 viewer reads every control once when it opens. Run with the camera (one camera, one session, through a USB hub, 2026-11-24): the viewer with this change showed 2700 frames on each of three opens and 1686 frames on a fourth, with no stall error. The earlier version was not run in that session, so whether this change is what prevents the stall is not established.
An index opens another camera with backend="msmf", or backend="any" refuses
OpenCV's Media Foundation backend counts device indexes in Media Foundation's list, and DirectShow in its own. The two lists can be in a different order (seen once, on one PC with one camera, 2026-11-24), so an index goes only with the backend whose list it came from. DeviceConfig.weevia_s1(backend="msmf") finds the camera by name in the Media Foundation list. With backend="any" the index is used only when the Weevia S1 has the same index in both lists; otherwise DeviceError asks for backend="msmf" or backend="dshow". Opened through Media Foundation, the camera controls go through OpenCV's fallback — no ranges or defaults, and no power_line_frequency or auto_exposure_priority (low-light compensation) — the price of getting StereoFrame.driver_ns, which is None with DirectShow, the Windows default. Finding the camera by name in the Media Foundation list, and the Media Foundation lists of list_devices.py --backend msmf and the doctor: run with the camera in two USB re-insert cycles (one Weevia S1 unit, one PC, 2026-11-25, the published 0.0.7 wheel).

Controls

A setting did not stick
Look at result.kept: it says whether what the camera reports after the write matches what you wrote. A written result only means the driver accepted the value — see Capture.
“ControlStateError: auto_exposure is on …” or “exposure cannot be set in the same call that turns auto_exposure on”
An exposure value is refused while auto_exposure is auto, or in the same call that switches it to auto. Give the mode and the value in one call: set_many({"auto_exposure": "manual", "exposure": -5}) — see Capture.
“… is not a camera control — set resolution, fps and format in DeviceConfig”, or “… must not be set through extra_props”
Resolution, frame rate and format are set when the camera opens; set_prop() and extra_props refuse them. Pass them to the config instead, e.g. DeviceConfig.weevia_s1(fps=60), and read cam.mode for what the driver gave.
“value_range not set — the normalized (0..1) API needs a range”
LedControl.set_level() and get_level() need the control's range, and LedControl has none unless you give it. Create it as LedControl(cam, value_range=(0, 96)), or use set()/get() with raw values — see IR flood.

Calibration

“No calibration installed” or “N calibrations installed (…)”
cam.calibration uses the installed file only when there is exactly one. Install the file for your camera with python -m opticmix_vision.calib add <file.json>, or delete the other files from the folder the message names — see Install.
“This calibration is for 800x800 eyes. Open the 1600x800 mode.”
cam.calibration compares the eye size in the file with the mode the camera was opened in (half the frame width, the full height). Open the mode the message names; DeviceConfig.weevia_s1() opens 1600×800 unless you override width or height.

Linux

“libGL.so.1: cannot open shared object file” (Linux)
OpenCV needs libGL.so.1 from the system; without it import opticmix_vision still works, but everything that uses OpenCV, opening the camera included, fails. On Debian/Ubuntu, sudo apt install libgl1 libglib2.0-0 — see Install.
Permission denied on /dev/videoN (Linux)
Your user needs read and write access to the camera's /dev/videoN. Over SSH or from a service, add the user to the video group. Access through the video group has not been run with the camera.
Linux permissions (python/README.md, v0.0.11)

① Verification conditions: the published 0.0.7 wheel, one Weevia S1 unit, Windows 11, one PC, two-level USB hub, two USB re-insertions, read-only.