GithubHelp home page GithubHelp logo

altunenes / scramblery Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 47.58 MB

Apply different scrambling techniques, including Fourier phase, on entire images or just faces in both images and videos

Home Page: https://altunenes.github.io/scramblery/scramblerydemo.html

License: MIT License

Python 25.14% JavaScript 74.86%
face scramble scramble-face experimental-psychology face-detection psychology image-manipulation fourier fourier-transform

scramblery's Introduction

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.

Citation

Altun, E. (2023). altunenes/scramblery: 1.2.5 (1.2.5). Zenodo. https://doi.org/10.5281/zenodo.10028991

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.

scramblery's People

Contributors

altunenes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scramblery's Issues

How to get facial landmarks?

I am trying out the scripts you provided, though get_facial_landmarks is not described on the webpage. :(

How to define face area in the script.

scramleimage worked for me, but nor scramble face, nor scramblevideo... and demo's does not work me either.

help!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.