Skip to main content

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

Metadata

Release files for mooney-maker 0.1.1

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

Source distribution (sdist)

Source distribution for mooney-maker 0.1.1
File Size Uploaded
mooney_maker-0.1.1.tar.gz 296.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mooney-maker 0.1.1
File Interpreter ABI Platform
mooney_maker-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 608.1 kB

Release files / mooney_maker-0.1.1.tar.gz

Download URL mooney_maker-0.1.1.tar.gz
Size 296.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f36f7f28e1ea5783e92d7fb321bc215b4b29214a5d03d63ac4003c50503fe8e0
BLAKE2b-256 checksum
How to use checksums
89f90b1bb53455a17e996e2e2f0ea63b5d9330947e63947c98c002ee330af0bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.25

Release files / mooney_maker-0.1.1-py3-none-any.whl

Download URL mooney_maker-0.1.1-py3-none-any.whl
Size 312.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85830eb9ccdf24ef98b47693715d7a0082987aa421c98cadcccb47ceddface62
BLAKE2b-256 checksum
How to use checksums
9931a22aaa86eb618e88f3e49adbf02d8f53ef8a93a2d17f633b642253f9f034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.25

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

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