Skip to main content

Scramblery

Downloads PyPI version Jekyll site CI Build status DOI

sacasc

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.

    8x8

    12x12 8x8

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.

Metadata

Release files for scramblery 1.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scramblery 1.2.5
File Size Uploaded Provenance Actions
scramblery-1.2.5.tar.gz 8.6 kB Without provenance Details for scramblery-1.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scramblery 1.2.5
File Interpreter ABI Platform Actions
scramblery-1.2.5-py3-none-any.whl Python 3 none any Details for scramblery-1.2.5-py3-none-any.whl

Total release size: 16.8 kB

Release files / scramblery-1.2.5.tar.gz

Download URL scramblery-1.2.5.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6632a09635b8dbaecbddc5e4a3339c66112ec3935907e7f941f2125673fef07a
BLAKE2b-256 checksum
How to use checksums
16ecd7f27ff8d82347b8c4f17a1b9bbc7a4126e592b6bd80c7132790f761377e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.9 Windows/10

Release files / scramblery-1.2.5-py3-none-any.whl

Download URL scramblery-1.2.5-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28dc4f671104cd498660ddf40fc0f08a1633b3c493615cc9e2ba476a942eca59
BLAKE2b-256 checksum
How to use checksums
d24f66b97648cc43ca47d18cb4bb9f190f88e4e418f8bdacb4630334ac678fda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.9 Windows/10

Security for scramblery 1.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page