Live Demo: lumina-cv.streamlit.app
Lumina CV is an interactive, real-time computer vision application built in Python using Streamlit, OpenCV, and Matplotlib. It allows users to upload custom images or use a default calibration pattern, adjust processing parameters through interactive sliders, and see side-by-side comparisons of the original and processed images along with dynamic RGB/grayscale histograms and execution speeds.
Direct pixel-level mapping functions ($s = T(r)$) to improve image quality:
-
Brightness Adjustment: Add/subtract intensity offset constant values (
$s = r + \beta$ ). -
Contrast Adjustment: Scale intensity values using multiplication gain factors (
$s = \alpha \cdot r$ ). -
Image Negative: Inverse intensity mapping (
$s = 255 - r$ ) to highlight dark features. - Log Transformation: Dynamic range compression ($s = c \cdot \ln(1 + r)$) to expand dark regions.
-
Power-Law (Gamma) Transformation: Non-linear gamma correction (
$s = c \cdot r^\gamma$ ) to adjust mid-tones. -
Thresholding: Map pixel values to binary limits (black and white) based on threshold limit
$T$ . -
Contrast Stretching: Linearly stretch narrow input intensity ranges to fill the full
$[0, 255]$ range.
Coordinate mappings to translate, shear, scale, or warp image shapes:
- Translation: Shift image coordinates horizontally and vertically.
- Scaling: Resize image dimensions with adjustable interpolation methods (Nearest Neighbor, Bilinear, Bicubic).
- Rotation: Rotate the image by custom degrees around any pivot point (e.g. image center).
-
Reflections:
- Horizontal: Flips image horizontally.
- Vertical: Flips image vertically.
-
Origin: Flips image both horizontally and vertically (
$180^\circ$ rotation).
- Shearing: Slant the image along the X-axis or Y-axis by a shearing factor.
-
Affine Transformation: Warp the image using three control points (Top-Left, Top-Right, Bottom-Left offsets) displaying the resulting
$2 \times 3$ transformation matrix in real-time.
During development, the following runtime issue was encountered:
- Symptom: When launching the application (
app.py), the program crashed during initialization at:Outputting aimport matplotlib.pyplot as plt
ModuleNotFoundErrorbecausematplotlibwas missing from the virtual environment packages. - Root Cause: Matplotlib was not included in the initial installation command, which only installed
streamlit,opencv-python,numpy, andpillow. - Resolution:
- Activated the virtual environment and installed the package:
./venv/bin/pip install matplotlib
- Gracefully terminated the old server process.
- Restarted the Streamlit server daemon:
./venv/bin/streamlit run app.py --server.port=8501 --server.headless=true
- Verified successful compilation and loading.
- Activated the virtual environment and installed the package:
- Python 3.10+
- pip
-
Clone this repository:
git clone <repository-url> cd image-processor
-
Set up Virtual Environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install streamlit opencv-python numpy pillow matplotlib
-
Run the application:
streamlit run app.py
The application will open automatically in your default browser at
http://localhost:8501.
Built by Dev-Aryan-Saxena (contact.aryan.dev@gmail.com).