Skip to content

GazingInSpring/looking-glass

Repository files navigation

Looking Glass

A toolkit for generating anamorphic art through computational pixel mapping. This project enables the creation of distorted images that resolve into recognizable forms when viewed from specific angles or reflected in carefully positioned mirrors.

Overview

Source Image transforms into Target Configuration


Pixel-by-pixel mapping in action

## Features
  • Priority-based pixel mapping for optimal visual quality
  • Configurable balance between color accuracy and spatial coherence
  • Progressive visualization of the mapping process
  • STL generation for 3D-printable mirror arrays (in development)
  • Real-time progress tracking with GIF generation

Installation

# Clone the repository
git clone https://github.com/yourusername/looking-glass.git

# Dependencies
- Kotlin 1.5+
- Java 11+

Usage

// Basic usage
val mapper = PriorityBasedMapper(
    sourceImage = ImageIO.read(File("source.png")),
    targetImage = ImageIO.read(File("target.png")),
    priorityMap = PriorityMapGenerator.radial(),
    maxK = 40000,
    colorWeight = 0.95,
    spatialWeight = 0.05
)

val mapping = mapper.computeMapping()

Configuration

Key parameters that affect the mapping:

  • maxK: Maximum number of neighbors to consider (default: 40000)
  • minK: Minimum number of neighbors to consider (default: 100)
  • colorWeight: Importance of color matching (0.0-1.0)
  • spatialWeight: Importance of spatial coherence (0.0-1.0)
  • switchThreshold: Point at which algorithm switches search strategies

Progress Visualization

The mapping process generates a real-time GIF showing the progressive construction of the image:

Progress visualization - placeholder

Current Status

  • ✅ Basic pixel mapping framework
  • ✅ Priority-based processing
  • ✅ Progress visualization
  • 🚧 Mirror array generation (in development)
  • 🚧 Physical optimization constraints
  • 📋 Cylindrical mirror support (planned)

Theory

The project implements anamorphic mapping through a priority-queue-based algorithm that:

  1. Processes pixels in order of visual importance
  2. Maintains both local color accuracy and global spatial relationships
  3. Adapts search complexity based on pixel priority

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

MIT License

Acknowledgments

This project draws inspiration from:

  • Historical anamorphic art techniques
  • Modern computational geometry
  • Digital image processing algorithms

Contact

Questions? Ideas? Feel free to open an issue or reach out directly.


Note: This project is currently under active development. Some features may be incomplete or subject to change.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors