Spaces:
Runtime error
Runtime error
A newer version of the Gradio SDK is available: 6.25.0
metadata
title: CV Lab Camera Studio
emoji: π·
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 5.50.0
app_file: app.py
pinned: false
short_description: Computer vision, AR filters, and image analysis laboratory.
license: mit
CV Lab Camera
CV Lab Camera is a Gradio application and developer suite for computer vision, scientific image analysis, geometric transformations, morphology, neural style transfer, AR face overlays, and batch dataset processing.
Developer Quickstart
1. Web App
Launch the interactive Gradio laboratory:
python app.py
2. Command Line Interface (CLI)
Process images directly from your terminal or shell scripts:
# Apply built-in filter
python cli.py filter --input input.jpg --filter Sepia --output result.jpg
# Apply geometric transformation
python cli.py transform --input input.jpg --op Rotation --angle 45 --output result.jpg
# Apply morphological operation
python cli.py morph --input input.jpg --op Opening --size 5 --output result.jpg
# Apply AR face overlay
python cli.py ar --input face.jpg --filter Glasses --output ar_result.jpg
# Apply neural style transfer
python cli.py style --input content.jpg --style-image style.jpg --output stylized.jpg
# Batch process dataset
python cli.py batch --dir ./my_dataset --filter Grayscale --output-zip processed.zip
3. Python Developer SDK (developer_api.py)
Import CV Lab functions directly in your Python code:
from developer_api import process_image, generate_python_snippet
# Process image programmatically
result, meta = process_image(
image_input="photo.png",
operation_type="filter",
operation_name="Sepia",
output_path="output_sepia.png"
)
# Generate copy-pasteable Python code
code = generate_python_snippet("Sepia", {"contrast": 1.2})
print(code)
Architecture Overview
AI_Lab_CAM/
βββ app.py # Gradio UI Web App (interactive tabs & code generator)
βββ cli.py # Developer Command Line Interface (CLI)
βββ developer_api.py # Developer SDK / Python API wrapper
βββ batch/
β βββ dataset_processor.py # Batch directory/zip processing with manifest.json
βββ cv_ops/
β βββ analysis.py # Intensity histograms & pixel statistics
β βββ morphology.py # Thresholding & morphological operations
β βββ transforms.py # Translation, rotation, scaling, reflection
βββ filters/
β βββ builtin.py # Pure NumPy / OpenCV filter functions
β βββ custom.py # Custom kernel & pipeline JSON parsers
β βββ registry.py # Filter registry & saved JSON persistence
βββ models/
β βββ face_filters.py # OpenCV AR face landmark detector & filter engine
β βββ style_transfer.py # TensorFlow Hub Magenta neural style transfer
βββ saved_filters/ # Saved custom filter JSONs
βββ saved_ar_filters/ # Saved custom AR filter JSONs
βββ tests/ # Pytest suite
βββ requirements.txt # Python dependencies
Custom Filters & AR Filters
Image Processing Filter Pipelines
Save multi-step filter pipelines as JSON:
[
{"operation": "Grayscale", "params": {}},
{"operation": "Sharpen", "params": {"amount": 1.4}}
]
Custom AR Face Filters
Design landmark-based AR overlays attached to head_top, forehead, eyes, nose, mouth, chin:
{
"elements": [
{
"landmark": "forehead",
"shape": "crown",
"color": [255, 215, 0],
"scale": 1.0,
"offset_y": -0.15
},
{
"landmark": "eyes",
"shape": "visor",
"color": [0, 255, 255],
"scale": 1.0
}
]
}
Testing
Run the test suite:
pytest