Skip to content

Work and research repository for pencil drawing robot application development.

License

Notifications You must be signed in to change notification settings

xgoga/FastRoboticPencilDrawing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language: Python License: MIT

About 🔍

This repository is a supplementary material to the research article

Open Access Fast robotic pencil drawing based on image evolution by means of genetic algorithm

and presents a software solution for creating a pencil drawing robot based on image evolution.

Video presentation 🎬

RD

Usage 💻

The generated output is controlled by changing user parameters inside the gen_drawing.py startup script:

# ------------------------------ USER PARAMETERS --------------------------
img_str = "Darwin_enhanced.jpg"  # image to load (from ./images folder)
basewidth = 256 # output width of generated image 
deterministic_mode = True  # reproducible results [True, False]
generate_gif = True # generate animation [True, False]
deterministic_seed = 42 # seed for pseudo-random generator
N = 6000 # number of objects in created image
# --- Genetic Optimization ---
NEvo = 10 # number of evolution steps per one optimized object 
MAX_BUFF = 5  # stopping evolution if there are no changes (MAX_BUFF consecutive evolution steps)
MAX_ADDMUT = 5 # [%] - maximum aditive mutation range
MUT_RATE = 20 # [%] - mutation rate (percentage of chromosomes to be mutated)
LINE_WIDTH = 2 # [px] line width
MLTPL_EVO_PARAMS = 1 # parameter multiplier
BLEND_MODE = "darken" # available options: ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color_dodge", "color_burn", "hard_light", "soft_light", "difference", "exclusion", "hue", "saturation", "color", "luminosity", "vivid_light", "pin_light", "linear_dodge", "subtract"]
# -------------------------------------------------------------------------

by default, input templates are loaded from the ./images folder. The output is a generated image according to the specification in .png format, including data .csv file and optional .gif animation all stored in the ./results folder. The csv file contains coordinates of the line segments endpoints x1, x2, y1, y2, the intensity of the pencil pressure (zero represent no pressure and coincides with the white shade on the canvas) and value of the fitness function after drawing the corresponding line segment in the generated image.

Data .csv file header:

x1 <0, image width-1> x2 <0, image width-1> y1 <0, image height-1> y2 <0, image height-1> Pencil pressure <0, 255> Fitness value

Results ✏️

Image Evolution Final generated image Original template

Example images 📷

License: ODbL All images used in this work identified by Pixabay, are free of known copyright restrictions.

Dependencies 💫

The code was tested under Python>=3.7 and uses these modules:

  • numpy >= 1.18.5
  • Pillow >= 7.2.0
  • matplotlib >= 3.2.1
  • image4layer >= 0.43.4

Citing 📚

If you find this open source project useful, please reference in your paper:

@article{adamik2021frpd,
  title={Fast robotic pencil drawing based on image evolution by means of genetic algorithm},
  author={Adamik, Michal and Goga, Jozef and Pavlovicova, Jarmila
          and Babinec, Andrej and Sekaj, Ivan},
  journal={Robotics and Autonomous Systems},
  year={2022},
  pages = {103912},
  volume = {148},
  issn = {0921-8890},
  doi = {https://doi.org/10.1016/j.robot.2021.103912},
  url = {https://www.sciencedirect.com/science/article/pii/S0921889021001974}
}

Contact ✉️

The research behind this work was conducted by:

Michal Adamík, Jozef Goga, Jarmila Pavlovičová, Andrej Babinec, Ivan Sekaj

at

in collaboration with

                                       

About

Work and research repository for pencil drawing robot application development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages