GithubHelp home page GithubHelp logo

phongvv-1613 / linedrawer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nathanbain314/linedrawer

0.0 0.0 0.0 33.44 MB

Draws an image using only straight lines

C++ 85.66% Makefile 13.71% CMake 0.63%

linedrawer's Introduction

lineDrawer

Draws an image using only straight lines and computes a single path to create it.

RunLineDraw

Based on the website linify.me, this finds the darkest point on an image, and then chooses the darkest line passing through it. Since there aren't any actual points used the shortest path is not computed.

options

  • -i, --input : Input image.
  • -o, --output : Output image.
  • -n, --number : Number of lines to draw.
  • -d, --darkness : Darkness of lines. Integer from 1 to 255, with 255 being completely black.
  • -v, --inverted : Draw white lines on a black background

RunLineRect

Finds the darkest line on the image between two points on the outside of the image and draws it.

options

  • -i, --input : Input image.
  • -o, --output : Output image.
  • -n, --number : Number of lines to draw.
  • -p, --points : Number of points on outside
  • -d, --darkness : Darkness of lines. Integer from 1 to 255, with 255 being completely black.
  • -v, --inverted : Draw white lines on a black background.
  • -t, --numPaths : Maximum number of paths to check.

RunLinePolygon

Finds the darkest line on the image between two points on a polygon or ellipse and draws it.

options

  • -i, --input : Input image.
  • -o, --output : Output image.
  • -n, --number : Number of lines to draw.
  • -p, --points : Number of points on outside
  • -d, --darkness : Darkness of lines. Integer from 1 to 255, with 255 being completely black.
  • -s, --sides : Number of sides on polygon. Less than three will create an ellipse.
  • -w, --width : Width of the encompassing ellipse.
  • -h, --height : Height of encompassing ellipse.
  • -x, --xOffset : x position offset.
  • -y, --yOffset : y position offset.
  • -a, --angle : Rotation angle.
  • -v, --inverted : Draw white lines on a black background
  • -t, --numPaths : Maximum number of paths to check.

Tips

After the program decides on what edges to use it computes the shortest path that travels through every required edge. This algorithm has a rather high complexity and would take an exceptionally long time to compute the true shortest path, so in order to speed it up you can set a maximum number of paths to check per node. Increasing the number of lines increases the computation time linearly while increasing the number of points increases it quadratically. If you use a small number of points there will not be enough lines that can be drawn to create a similar image. If you have too many points the program may waste lines on short lines between close edges, so you will need to adjust the settings until the image looks correct. The RunLineDraw program is considerably faster since it can make use of a greedy algorithm to check fewer lines. Inverted pictures create an interesting look but will often leave black eye sockets on portraits.

Examples

Input

Input image

RunLineDraw

Draw

Inverse

Inverse

RunLineRect

Rectangle

RunLinePolygon

Triangle flattened and rotated
Triangle
Pentagon narrowed and rotated
Pentagon
Hexagon
Hexagon
Ellipse with 64, 128, 256, 512 points and 256, 512, 1024, 2048 lines of darkness 256, 128, 64, 32.
Ellipse

Path

I used the computed path and a single line of string to create a real example on a 16 sided polygon. The first picture is on a wall, the second is silhouetted on a bright sky, and the third is the shdoow of the string String

linedrawer's People

Contributors

nathanbain314 avatar

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.