Spaces:
Runtime error
Runtime error
File size: 3,904 Bytes
887cada 444ff93 887cada 444ff93 887cada 444ff93 887cada 8096125 887cada 8096125 887cada 8096125 b0c1552 8096125 b0c1552 8096125 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | ---
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:
```bash
python app.py
```
### 2. Command Line Interface (CLI)
Process images directly from your terminal or shell scripts:
```bash
# 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:
```python
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:
```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`:
```json
{
"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:
```bash
pytest
```
|