Giter Site home page Giter Site logo

nickvdw / image-to-voronoi Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 0.0 3.02 MB

Convert an image into a nice-looking Voronoi diagram using one of many available techniques with options for customization.

JavaScript 46.70% HTML 0.58% Vue 52.73%
image-style-transfer image-stylization image-to-voronoi voronoi voronoi-diagram

image-to-voronoi's Introduction

image-to-voronoi's People

Contributors

dependabot[bot] avatar johnnynater avatar jurvanwinden avatar nickvdw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

image-to-voronoi's Issues

Create and improve UI elements

  • Menu on the left with parameter configuration
  • Image on the right with a possibility to look at previous image
  • Additional pages in the navbar (e.g., 'about', 'help', etc)

Improve centroid generation

We can take a look at using contrasts to generate centroids instead of greyscaling. Contrasting may highlight some important borders that could be used to generate centroids to make better Voronoi diagrams.

You could also allow the user to select the region they want to be converted to Voronoi. This user selection could prevent that less important areas in an image are going to be full of centroids and to eventually 'steal the show'.

Shape/Face recognition techniques could also be used. This requires some form of ML.

Fit result to parent div

  • The result needs to fit in the parent div.
  • Clicking the full screen button should still result in showing the WHOLE result rather than the fitted result.
  • Saving the result should result in saving the WHOLE result rather than the fitted result.

Resizing image

We can use

https://github.com/LinusU/resize-image-data

and add the following code in imageHandler.js

image.addEventListener("load", () => {
        const aspectRatio = image.width / image.height;
        canvas.width = image.width;
        canvas.height = image.height;
        context.drawImage(image, 0, 0);
        const imageData = context.getImageData(0, 0, image.width, image.height);

        const newWidth = image.width / 10;
        const newHeight = newWidth / aspectRatio;
        const result = resizeImageData(
          imageData,
          newWidth,
          newHeight,
          "nearest-neighbor"
        );
        console.log(result);
        resolve(result);
      });

Advantages:

  • Faster rendering
  • Less laggy

Disadvantages:

  • Both bilinear-interpolation and nearest neighbours kind of "ruin" the structure that was present, which leads to worse results

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.