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.
Purpose of Package
The purpose of this package is the creating scrambled images from images or videos. User can either scramble the whole image or only facial area. This is very useful tool in psychology experiments especially if you are working with faces. With a for loop you can scramble all the images in a folder and create a new folder with scrambled images. It was very long process to scramble images manually in the past and I feel like this package can be useful for many people. Hope this package will be useful for your research.
Motivation
-
Image scrambling is important in psychology experiments because it allows researchers to control the content and structure of visual stimuli, while removing or altering specific features or patterns that might influence participants' perception or response.
-
By scrambling an image, researchers can create a version of the image that preserves the overall luminance, contrast, and spatial layout, but that removes or distorts specific features or patterns that might be relevant for the experiment. For example, researchers might scramble an image of a face to remove the facial features, while preserving the overall brightness and contrast, or they might scramble an image of a scene to remove the objects, while preserving the spatial layout and color.
-
It allows researchers to control for potential confounds and biases that might arise from the content of the stimuli. By removing or distorting specific features or patterns, researchers can create stimuli that are less predictable and less likely to elicit specific responses from participants. This can help researchers to isolate the effects of the manipulated variables, and to reduce the influence of confounding factors that might interfere with the interpretation of the results.
Features
- Scramble whole image with desired degree of scrambling (pixel values or pixel coordinates)
- Scramble only facial area with desired degree of scrambling (pixel values or pixel coordinates)
- Scramble only facial area in a video (useful for dynmaic stimuli) with desired degree of scrambling
Installation
- The package can be found in pypi. To install the package, run the following command in the terminal:
pip install scramblery
Author
- Main Maintainer: [Enes ALTUN]
Usage
After installing the package, you can import the package as follows:
-
from scramblery import scramblery
Then use the functions as follows to scramble images. I added some examples below.
Code example:
from scramblery import scramblery
scramblery.scrambleimage("Lena.png", x_block=10, y_block=10, scramble_type='classic',seed=None,write=True)
#note: seed is optional, none means random seed
If you want to scramble images in a folder, check the API section here for an example: API.
Javascript Demo
Update: Also, with the same paradigm, I have created an animated version of scramblery. It's shuffling pixel values and coordinates in a given ratio then it's arranging them back in the original order. You can find the online demo in javascript here.
example (gif animation):
Contributon
Any kind of contribution is welcome.
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
Hashes for scramblery-1.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6efc2500847f881037fb55f7b7d702c54211ac27b27701ebe8d5dd6ef029780b |
|
MD5 | 9cc80eb6273a9f04c1e8c1e038c1db7a |
|
BLAKE2b-256 | 4833fa16e00673c5f0b2cd880135bd2f7dfd1440a5ceab07fa54cdd5f563438e |