Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Blindsight Visual Prosthesis Simulator

A research-grade simulation of phosphene vision experienced by users of cortical or retinal visual prostheses (also known as "bionic eyes" or "blindsight" implants). This tool models many perceptual distortions reported in human implant recipients, including phosphene size, shape, dropout, scintillation, current spread, cortical magnification, radial elongation, and head-movement stabilization.

The simulator supports real-time webcam input (default) or static images, feature-enhanced processing, optional sonification, and GIF export.

Features

  • Implant types:

    • Cortical: Log-polar retinotopic mapping (foveal magnification, peripheral compression)
    • Retinal: Uniform grid (no cortical warping)
  • Phosphene modeling:

    • Gaussian (elliptical) phosphenes with variable size and orientation
    • Radial elongation in cortical implants (phosphenes stretched along visual field radii)
    • Current-dependent spread and saturation
    • Eccentricity-dependent size scaling
    • Random variation in individual phosphene shape
    • Dropout (intermittent phosphene failure)
    • Temporal scintillation noise
    • Neighbor crosstalk
  • Visual processing:

    • Multiple feature extractors: Difference-of-Gaussians (DoG, default), Canny edges, high-pass (Laplacian)
    • Perceptual brightness compression (gamma)
  • Interaction & dynamics:

    • Slow naturalistic head movement (sinusoidal)
    • Manual saccade simulation (s key) and shift reset (r)
    • Visual field overlay with eccentricity rings and meridians (cortical mode)
  • Sonification (optional):

    • Global scene brightness mapped to pitch (requires headphones)
  • Output:

    • Side-by-side view: original camera/image vs. simulated phosphene vision
    • GIF export of static-image runs

Requirements

  • Python 3.7+
  • OpenCV (cv2)
  • NumPy
  • Matplotlib
  • Pygame (only if --enable_sonification is used)

Install dependencies with:

pip install opencv-python numpy matplotlib pygame pillow

Usage

Run the simulator with default settings (32×32 electrode grid, webcam, cortical implant, DoG features):

python blindsightv5.py

Common Command-Line Options

Argument Default Description
--grid_size 32 Electrodes per side (e.g., 16, 32, 64)
--implant_type cortical cortical or retinal
--no-use_webcam (webcam on) Use static image instead of webcam
--image_path example_image.jpg Path to static image
--feature_extractor dog dog, canny, or highpass
--dropout_prob 0.10 Phosphene dropout probability
--temporal_noise_std 0.08 Scintillation noise strength
--crosstalk_factor 0.10 Current spread to neighboring electrodes
--radial_elongation 1.3 Radial stretching factor (>1 = elongated)
--enable_sonification False Map average brightness to sound pitch
--no-head_movement (on) Disable slow head sway
--save_gif False Save animation as GIF (static mode only)
--gif_path blindsight_simulation.gif Output GIF filename
--gif_duration 10.0 GIF length in seconds

Full list of arguments:

python blindsightv5.py --help

Interactive Controls (during live run)

  • s – Simulate a saccade (random shift)
  • r – Reset head/saccade shift to center
  • q / w – Cycle backward/forward through feature extractors

Example Commands

  1. Retinal implant, 64×64 grid, no warping
python blindsightv5.py --implant_type retinal --grid_size 64
  1. Static image, save 15-second GIF
python blindsightv5.py --no-use_webcam --image_path my_scene.jpg --save_gif --gif_duration 15
  1. With sonification and stronger dropout
python blindsightv5.py --enable_sonification --dropout_prob 0.25

Notes

  • The simulation is intended for research, education, and awareness of visual prosthesis perception.
  • Parameters are inspired by published psychophysical data (e.g., Beauchamp et al., Schmidt et al., etc.), but remain phenomenological approximations.
  • Performance depends on grid size; larger grids (e.g., 64×64) are slower but more detailed.

License

This code is provided for non-commercial research and educational use. Feel free to modify and extend it.

Enjoy exploring the strange and fascinating world of artificial vision!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors