No project description provided
Project description
Scramblery
A simple tool to scramble your images or only faces from images or videos. You can find the online demo in javascript here. For more information, please visit the documentation.
Note: The Javascript demo doesn't have a face detection algorithm and it's designed to be applied to a single image. If you want to do this for multiple imagees you should use Python.
Purpose of Package
The Scramblery package offers tools for creating scrambled images from existing images or videos. Users have the flexibility to scramble entire images or target only specific areas, such as faces. This functionality is particularly beneficial in psychological experiments involving facial recognition tasks. With Scramblery, users can automate the scrambling of multiple images, eliminating the tedious manual process traditionally associated with this task. We hope this package significantly contributes to your research endeavors.
Motivation
-
Image scrambling plays a crucial role in psychology experiments, enabling researchers to manipulate visual stimuli while maintaining control over certain visual aspects. This manipulation helps eliminate or alter specific features or patterns that may influence participants' perceptions or responses.
-
Scramblery allows for the creation of stimuli that retain general attributes such as luminance, contrast, and spatial layout, but lack identifiable features or objects. This is useful in experiments where researchers wish to control for these specific attributes.
-
The package helps in mitigating biases and confounding variables in stimuli, thereby providing more reliable and valid experimental conditions. The ability to automate this process ensures consistency across stimuli and saves valuable time for researchers.
Features
- Scramble an entire image with a specified degree of scrambling (either by altering pixel values or pixel coordinates).
- Target scrambling to only the facial area within an image, with customizable levels of scrambling.
- Extend the scrambling feature to videos, particularly useful for dynamic stimuli in motion-based experiments.
- Leverage Fourier-based scrambling to disrupt the phase information while maintaining the power spectrum, particularly useful for psychophysical studies.
Installation
Scramblery is available on PyPI and can be installed using pip. Use the following command in your terminal:
Installation
-
The package can be found in pypi. To install the package, run the following command in the terminal:
-
pip install scramblery
-
from scramblery import scramblery
Then use the functions as follows to scramble images. I added some examples below.
Usage
After installation, you can import and use Scramblery as follows:
from scramblery import scramblery
# To scramble an entire image
scramblery.scrambleimage("Lena.png", x_block=10, y_block=10, scramble_type='classic', seed=None, write=True)
# To scramble only the facial area within an image
scramblery.scrambleface("Lena.png", splits=10, type='pixel', seamless=False, bg=True, seed=None, write=True)
# To apply Fourier-based scrambling on an image
scramblery.scrambleimage("Lena.png", scramble_type='fourier', scramble_ratio=0.5, seed=None, write=True)
# To apply Fourier-based scrambling o only the facial area within an image
scramblery.scrambleface("lena.png",splits=10,type='fourier', scramble_ratio=0.5,write=True)
# To scramble faces within a video first we need to create a dict.
scramble_settings = {
'splits': 25,
'type': 'pixel',
'bg': True,
'seed': None,
'write': False # Should always be False for video processing
}
scramblery.scramblevideo("input_video.mp4", "output_video.mp4", scramble_settings)
Contribution
We welcome contributions of any kind to Scramblery. If you have ideas for improvement or have found a bug, please don't hesitate to contribute.
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
Built Distribution
File details
Details for the file scramblery-1.2.5.tar.gz
.
File metadata
- Download URL: scramblery-1.2.5.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6632a09635b8dbaecbddc5e4a3339c66112ec3935907e7f941f2125673fef07a |
|
MD5 | eba21248358ef33bc4151af0a814f2c5 |
|
BLAKE2b-256 | 16ecd7f27ff8d82347b8c4f17a1b9bbc7a4126e592b6bd80c7132790f761377e |
File details
Details for the file scramblery-1.2.5-py3-none-any.whl
.
File metadata
- Download URL: scramblery-1.2.5-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28dc4f671104cd498660ddf40fc0f08a1633b3c493615cc9e2ba476a942eca59 |
|
MD5 | b9a594c1c1624cbbd9278f402d583728 |
|
BLAKE2b-256 | d24f66b97648cc43ca47d18cb4bb9f190f88e4e418f8bdacb4630334ac678fda |