Giter Club home page Giter Club logo

polygonize's Introduction

Polygonize

An algorithm to polygonize images. Make images more concise, an effect like paper cut in photoshop. Also support to fix the direction of edges to make them more regular.

wave_fix

The Great Wave off Kanagawa, Katsushika Hokusa, 1831

the_starry_night

The Starry Night, Vincent van Gogh, 1889

portrait_of_unknown_woman_squ

Portrait of an Unknown Woman, Ivan Kramskoi, 1889

Core ideas:

  • Using Superpixel to segment images
  • Create region adjacency graph
  • Merge adjacent regions base on certain thershold
  • Extract separate fused regions and their colors
  • Polygonize each area
  • [Fix directions]

Requierments

  • Python 3.x
  • opencv-python > 4.5
  • skimage
  • numpy

Usage

python main.py input.jpg output.jpg [-d fix-option]
fix-option == 1: create octagon like polygons, with all lines vertical or horizontal or 45 degrees oblique
fix-option == 2: create rectangle like polygons, with all lines vertical or horizontal

Support SVG format output ๐Ÿ˜‹

Next

  • Add more polygon edge diretion fix options
  • Add pre-processing to increase the contrast to make the segmentation effect more obvious
  • Remove noise

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.