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
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.
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
Datasetclass 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
-
Clone the repository:
git clone [https://github.com/your-username/german_signs.git](https://github.com/your-username/german_signs.git) cd german_signs
-
Create and activate a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41c2d7387129c5157c6162e075b78329b9b1b494d029a6ed27cfdcfc9789d2e6
|
|
| MD5 |
d3e840e4dadda218434a122b0b35bcba
|
|
| BLAKE2b-256 |
301a7844b2c260d7549e381b9e8c3dfe1145a904214ca8a96c047f75cf957c1a
|
Provenance
The following attestation bundles were made for camera_occlusion-0.1.1.tar.gz:
Publisher:
publish.yml on kilojoules/camera_occlusion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
camera_occlusion-0.1.1.tar.gz -
Subject digest:
41c2d7387129c5157c6162e075b78329b9b1b494d029a6ed27cfdcfc9789d2e6 - Sigstore transparency entry: 402770382
- Sigstore integration time:
-
Permalink:
kilojoules/camera_occlusion@4b8da50e032d51b6c6cda180dc47e0ca5006827e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/kilojoules
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4b8da50e032d51b6c6cda180dc47e0ca5006827e -
Trigger Event:
push
-
Statement type:
File details
Details for the file camera_occlusion-0.1.1-py3-none-any.whl.
File metadata
- Download URL: camera_occlusion-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e5bd1b97e56dfe96ed00f036f04dc8b37340b6d7cfe4a6493a3ba461a1beba6
|
|
| MD5 |
f16b03737a30af8428c6cdc9c36fbd7f
|
|
| BLAKE2b-256 |
2c1a0d4ac9d709a3fde665163156dcdc20eb60bfdb396c02def0db0cbe3ca4e0
|
Provenance
The following attestation bundles were made for camera_occlusion-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on kilojoules/camera_occlusion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
camera_occlusion-0.1.1-py3-none-any.whl -
Subject digest:
3e5bd1b97e56dfe96ed00f036f04dc8b37340b6d7cfe4a6493a3ba461a1beba6 - Sigstore transparency entry: 402770405
- Sigstore integration time:
-
Permalink:
kilojoules/camera_occlusion@4b8da50e032d51b6c6cda180dc47e0ca5006827e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/kilojoules
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4b8da50e032d51b6c6cda180dc47e0ca5006827e -
Trigger Event:
push
-
Statement type: