--- 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 ```