Let there be light!
Lumos is a collection of tools and utility constructs to enable smart computer vision applications.
- Python 2.7.x
- NumPy (lumos doesn't need SciPy, just NumPy, but it doesn't hurt)
- OpenCV 4.2.0
- PyZMQ (optional, for streaming/pub-sub servers)
Windows users, please note: NumPy binaries are not available for 64-bit Python, so get 32-bit, or build NumPy from source. Also setup Python bindings for OpenCV.
-
Clone:
$ git clone git@github.com:napratin/lumos.git
-
Install:
$ [sudo] python setup.py develop
Note: This installs lumos in development mode, which means lumos modules are exposed directly from the directory you cloned it in. You can then
git pullto update your local copy, and/or make changes yourself. You can also use[sudo] python setup.py installfor a typical installation (recommended: Python virtual environment). -
Run:
$ python -m lumos.tools.camview
-
Develop:
"""A sample lumos application.""" import cv2 # OpenCV functions from lumos.base import FrameProcessor # base processor class from lumos.input import run # driver function class MyAwesomeProcessor(FrameProcessor): """Custom processor that selects hues based on current time.""" def process(self, imageIn, timeNow): # Convert input Red-Green-Blue image to Hue-Saturation-Value hsv = cv2.cvtColor(imageIn, cv2.COLOR_BGR2HSV) h, s, v = cv2.split(hsv) # split into 3 channels h = h.reshape(h.shape + (1,)) # Pick desired hue range based on current time hue = int(((timeNow % 10) / 10) * 180) min_hue = max(0, hue - 10) max_hue = min(180, hue + 10) # Apply mask to select pixels in hue range and return mask = cv2.inRange(h, min_hue, max_hue) imageOut = cv2.bitwise_and(imageIn, imageIn, mask=mask) return True, imageOut if __name__ == "__main__": # Run a custom processor instance (NOTE pass in class name) run(MyAwesomeProcessor, description="A sample lumos application")
Included as
sample.py(run:$ python -m sample).