Giter Site home page Giter Site logo

kmcelwee / mondrianify Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 53.32 MB

A pipeline for turning images into paintings by Piet Mondrian

Home Page: https://twitter.com/PietMondrianAI

License: MIT License

Python 100.00%
piet-mondrian art-generator edge-detection

mondrianify's Introduction

mondrianify

A pipeline for turning images into paintings by Piet Mondrian. Interested in seeing examples? Check out the Twitter bot @PietMondrianAI and its respective repo mondrianify-twitter.

Mondrianify flowchart

Getting setup locally

Using Python version 3.7, run pip install -r requirements.txt. Then run python MondrianPipeline.py. The script will draw a random photo from Unsplash and apply the transformation. The default directory output will be created and the image files will be placed inside. Similar to mondrianify-twitter, you can import this code by cloning this repository, placing it as a subdirectory, and running:

from mondrianify.MondrianPipeline import MondrianPipeline

random = True
mp = MondrianPipeline(image_path, random=random)
mp.apply_image_transform()

MondrianPipeline.py

The overarching class to help usher an image through the entire transformation. As it steps through the pipeline, it periodically saves the images output by the helper classes to a defined output directory. It relies on the classes in helpers to complete most phases of the process.

Helpers

  • BorderBuilder.py: Helps apply Holisticly-Nested Edge Detection to an image so that we can pull out its major features.
  • ColorBuilder.py: Determines the colors used in a Mondrian painting. It draws from colors.py, a file created by sampling from Mondrian's palette.
  • LineBuilder.py: Create many KMeans models to get a rough sketch of the segments that define an image. Then build out a Mondrian framework from those sketches.
  • Painting.py: Combines the LineBuilder and ColorBuilder classes to create the final Mondrian painting.

mondrianify's People

Contributors

kmcelwee avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

mondrianify's Issues

Institute smoke testing

  • remove test-fish.png from .gitignore
  • run the pipeline on a local image, and run the pipeline on an unsplash image

Expand to process video.

This may constitute a separate repository. Create a function that processes a full video. What kind of videos might this be most interesting for?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.