Back to list

Generation of coloring books

Details

Conversion of raster images to vectorized coloring books

The Python script converts raster images into vector type ones. Vector images are bunched up into a coloring book consisting of multiple pattern drawings with bordered segments where each segment has a color code inside.

These 2 steps - images vectorization and coloring book generation - are made as two independent modules. That’s why it’s possible to produce coloring books using even other vector images that were generated outside this application.

gerbera_large.PNG

Each module has configurable options to tune the algorithm, such as:

  • sensitivity of details that will be applied during vectorization process,
  • minimal dimensions of segments and minimal segments area,
  • curves smoothing algorithm and its parameters,
  • supported number of colors,
  • color palette,
  • font-family, label type and color,
  • line color and thickness.

Depending on requirements to a style of final patterns the application has several algorithms for generating border lines of color segments. They allow to smoothen the curves, to edge, and to keep parts of certain lines straight.

Algorithm description

At the first stage of operating, the algorithm generates pixel groups which are integral areas visually indistinguishable by color. To achieve this result the developers used a modified statistical region merging algorithm with further removal of too small segments. To speed up the algorithm they applied vector operations of C++ libraries, detection and preprocessing of big monotone regions, etc.

To eliminate a potential issue related to a lack of CPU for processing big images, the ability to process big data by parts was implemented.

At the second stage, a specialized algorithm for merging closed segments of SVG images was developed. Additionally, the team integrated an adaptive algorithm for detecting optimized positions for text inside the segments considering their sizes and rotation angles.

ein2.PNG
ein3.PNG
Services
Development time
7 weeks 1 developer