Skip to content

COO-Utilities/lightel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightel DI-2000

A small Python interface for the Lightel DI-2000 USB digital inspector.

The public DI-2000 documentation describes a USB video camera but does not publish a command protocol or SDK. This package therefore uses the operating system's camera driver through OpenCV. It supports camera discovery, connection, frame acquisition, image capture, and standard UVC/OpenCV properties.

Installation

pip install .

For development:

pip install -e ".[dev]"
python -m pytest

Usage

from di2000 import Di2000, find_devices

print("Camera indexes:", find_devices())

inspector = Di2000()
inspector.connect(0)
try:
    frame = inspector.read_frame()
    saved_path = inspector.capture_image("inspection.png")
    print(saved_path)
finally:
    inspector.disconnect()

On Windows, Lightel's installed camera driver may work better through DirectShow:

import cv2
from di2000 import Di2000

with Di2000() as inspector:
    inspector.connect(0, backend=cv2.CAP_DSHOW)
    inspector.capture_image("inspection.png")

Standard camera controls can be attempted through OpenCV:

import cv2

inspector.set_autofocus(True)
inspector.set_property(cv2.CAP_PROP_BRIGHTNESS, 100)
print(inspector.get_property(cv2.CAP_PROP_BRIGHTNESS))

Whether a property works depends on the Lightel driver. The probe's physical one-touch autofocus and capture buttons may use vendor-specific controls that are not publicly documented; this package does not guess those commands.

Finding the right camera

find_devices() returns all camera indexes OpenCV can open, not only Lightel devices. Disconnect other cameras or try each returned index and inspect a frame.

About

A driver class for the Lightel DI-2000.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages