Skip to main content

A Python package to automatically create ambiguous Mooney (two-tone) images

Project description

MooneyMaker

License: MIT

A Python package to automatically create ambiguous Mooney (two-tone) images.

Mooney images are two-tone stimuli that appear ambiguous initially but become recognizable once the observer has seen the template image. They are created by smoothing and thresholding an image. In the past, the size of the smoothing kernel and the threshold had to be selected manually. This process is not only time-consuming but also subjective, leading to inconsistencies across studies. MooneyMaker automates this process by providing multiple techniques for generating Mooney images.

Available Techniques

MooneyMaker supports nine different techniques for generating Mooney images:

  • Mean: Use predetermined smoothing kernel size and pixel intensity mean as threshold.
  • Otsu: Use predetermined smoothing kernel size and Otsu's method to determine the threshold.
  • CannyMaxEdge Use predetermined smoothing kernel size and select threshold which maximizes the number of edges detected by Canny edge detection.
  • CannyEdgeSimilarity: Optimize smoothing kernel size and threshold to maximize the similarity of the Mooney image's edges to the edges of the original image as detected by Canny edge detection.
  • CannyEdgeDisruption: Optimize smoothing kernel size and threshold to minimize the similarity of the Mooney image's edges to the edges of the original image as detected by Canny edge detection.
  • TEEDEdgeSimilarity: Optimize smoothing kernel size and threshold to maximize the similarity of the Mooney image's edges to the edges of the original image as detected by the Tiny and Efficient Model for the Edge Detection (TEED).
  • TEEDEdgeDisruption: Optimize smoothing kernel size and threshold to minimize the similarity of the Mooney image's edges to the edges of the original image as detected by TEED.
  • DiffusionEdgeSimilarity: Optimize smoothing kernel size and threshold to maximize the similarity of the Mooney image's edges to the edges of the original image as detected by the DiffusionEdge model.
  • DiffusionEdgeDisruption: Optimize smoothing kernel size and threshold to minimize the similarity of the Mooney image's edges to the edges of the original image as detected by the DiffusionEdge model.

The usage of different edge detection methods allows to optimize for similarity or disruption of different kinds of edges. Canny edge detection is a classic, non-neural, method, which detects all low level edges. TEED is a modern, efficient neural network model that detects edges at multiple scales, while DiffusionEdge is a diffusion-based model that captures object-level edges.

For more details on the techniques, refer to the techniques.ipynb notebook.

Installation

You can install MooneyMaker using pip:

pip install mooney_maker

Usage

Here's a basic example of how to use MooneyMaker to create a Mooney image from a template image:

from mooney_maker import generate_mooney_image

mooney_image = generate_mooney_image(
    image_path="path/to/your/image.png",
    output_path="path/to/results/",
)

For more advanced usage, including different techniques for Mooney image generation, refer to the examples directory.

Citation

If you use MooneyMaker in your research, please cite us:

@misc{reining2025mooneymaker,
  author = {Lars C. Reining and Thabo Matthies and Rabea Turon and Thomas S. A. Wallis},
  title = {MooneyMaker: A Python package to automatically create ambiguous Mooney (two-tone) images},
  year = {2025},
  publisher = {GitHub},
  journal = {GitHub repository},
  url = {https://github.com/ag-perception-wallis-lab/mooney_maker}
}

Acknowledgements

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

mooney_maker-0.1.1.tar.gz (296.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mooney_maker-0.1.1-py3-none-any.whl (312.0 kB view details)

Uploaded Python 3

File details

Details for the file mooney_maker-0.1.1.tar.gz.

File metadata

  • Download URL: mooney_maker-0.1.1.tar.gz
  • Upload date:
  • Size: 296.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.25

File hashes

Hashes for mooney_maker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f36f7f28e1ea5783e92d7fb321bc215b4b29214a5d03d63ac4003c50503fe8e0
MD5 48f33007933357059a4cff8fc224d1b1
BLAKE2b-256 89f90b1bb53455a17e996e2e2f0ea63b5d9330947e63947c98c002ee330af0bd

See more details on using hashes here.

File details

Details for the file mooney_maker-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mooney_maker-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85830eb9ccdf24ef98b47693715d7a0082987aa421c98cadcccb47ceddface62
MD5 d919bcf9134e2253c306c2db6840fec1
BLAKE2b-256 9931a22aaa86eb618e88f3e49adbf02d8f53ef8a93a2d17f633b642253f9f034

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page