Skip to main content

A library for applying realistic camera occlusion effects like rain and dust for computer vision data augmentation.

Project description

Realistic Camera Occlusion Effects for Computer Vision

PyPI version

This project provides a Python library and tools for applying realistic, parameterized camera occlusion effects like rain and dust to images. It's designed for data augmentation in computer vision tasks, such as training a traffic sign classifier to be more robust against adverse conditions.

Example noise image

Quick Start

pip install camera_occlusion
obscure-image GTSRB_dataset/GTSRB/Final_Training/Images/00000/00000_00000.ppm  out.ppm --effect rain

Features

  • Rain Effect: Simulates raindrops on a camera lens with distortion, shading, and highlights.
  • Dust Effect: Simulates fine dust specks, scratches, and semi-transparent grime splotches.
  • PyTorch Integration: Includes a Dataset class for on-the-fly data augmentation during model training.
  • Command-Line Tools: Apply effects to single images or train a model directly from the command line.

Installation

  1. Clone the repository:

    git clone [https://github.com/your-username/german_signs.git](https://github.com/your-username/german_signs.git)
    cd german_signs
    
  2. Create and activate a virtual environment (recommended):

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install the required packages:

    pip install -e .
    

Usage

There are three main ways to use this project:

1. As a Python Library

You can easily import and use the Rain and Dust effect classes in your own scripts.

import imageio.v2 as imageio
from camera_occlusion import Rain

# Load an image
image = imageio.imread("path/to/your/image.jpg")

# Apply a heavy rain effect
heavy_rain = Rain(num_drops=100, radius_range=(4, 8))
augmented_image = heavy_rain(image)

# Save or display the result
imageio.imwrite("rainy_image.jpg", augmented_image)

2. Gallery Demonstration

To see a gallery of all available effects and presets, run the example script. This will generate a plot showing various levels of rain and dust.

python examples/run_gallery.py

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

camera_occlusion-0.1.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

camera_occlusion-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file camera_occlusion-0.1.1.tar.gz.

File metadata

  • Download URL: camera_occlusion-0.1.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for camera_occlusion-0.1.1.tar.gz
Algorithm Hash digest
SHA256 41c2d7387129c5157c6162e075b78329b9b1b494d029a6ed27cfdcfc9789d2e6
MD5 d3e840e4dadda218434a122b0b35bcba
BLAKE2b-256 301a7844b2c260d7549e381b9e8c3dfe1145a904214ca8a96c047f75cf957c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for camera_occlusion-0.1.1.tar.gz:

Publisher: publish.yml on kilojoules/camera_occlusion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file camera_occlusion-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for camera_occlusion-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e5bd1b97e56dfe96ed00f036f04dc8b37340b6d7cfe4a6493a3ba461a1beba6
MD5 f16b03737a30af8428c6cdc9c36fbd7f
BLAKE2b-256 2c1a0d4ac9d709a3fde665163156dcdc20eb60bfdb396c02def0db0cbe3ca4e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for camera_occlusion-0.1.1-py3-none-any.whl:

Publisher: publish.yml on kilojoules/camera_occlusion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page