n-dimensional-flood-fill | dimensional implementation of flood fill | Artificial Intelligence library

 by   tuzz JavaScript Version: 1.0.0 License: No License

kandi X-RAY | n-dimensional-flood-fill Summary

kandi X-RAY | n-dimensional-flood-fill Summary

n-dimensional-flood-fill is a JavaScript library typically used in Artificial Intelligence, Numpy applications. n-dimensional-flood-fill has no bugs, it has no vulnerabilities and it has low support. You can install using 'npm i n-dimensional-flood-fill' or download it from GitHub, npm.

A non-recursive, n-dimensional implementation of flood fill.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              n-dimensional-flood-fill has a low active ecosystem.
              It has 10 star(s) with 2 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 0 open issues and 1 have been closed. On average issues are closed in 341 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of n-dimensional-flood-fill is 1.0.0

            kandi-Quality Quality

              n-dimensional-flood-fill has no bugs reported.

            kandi-Security Security

              n-dimensional-flood-fill has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              n-dimensional-flood-fill does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              n-dimensional-flood-fill releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of n-dimensional-flood-fill
            Get all kandi verified functions for this library.

            n-dimensional-flood-fill Key Features

            No Key Features are available at this moment for n-dimensional-flood-fill.

            n-dimensional-flood-fill Examples and Code Snippets

            No Code Snippets are available at this moment for n-dimensional-flood-fill.

            Community Discussions

            QUESTION

            A fast way to fill contours with the ability to export to a polygon-like format
            Asked 2020-May-09 at 16:19

            I have a number of medical pictures presented on canvas, as an example below.

            I’m trying to make a tool that allows you to select any area of ​​the image with the tool in the form of an expandable circle, and fill in only that part of it that doesn't go beyond the outline in which the original click pixel was located. A filled outline is drawn on a separate canvas layer.

            Now I use the most common iterative stack implementation of flood fill with variable tolerance (comparison function). You can familiarize yourself with it here. Everything doesn't work very well, especially in pictures where there are no strong contrast differences and in high-resolution images, everything else is pretty slow.

            I had the idea to create a state container and look for whether the desired filled outline exists there and if so, then just replace the canvas pixel array (though, again, I will have to resort to some additional processing, the canvas pixel array contains 4 channel, while at the output of the algorithm only 1 is obtained and just replacing the content doesn't work, you need to replace each pixel with a pixel divided into 4 channels) instead of a slow flood fill each time. But this approach has one significant problem: memory consumption. As you might guess, a filled outline, especially of a decent resolution alone, can take up quite a lot of space, and their set becomes a real problem of memory consumption.

            It was decided to store the finished contours in the form of polygons and extracting them from the container simply fill them with faster context fill. The algorithm used allows me to output a set of boundaries, but due to the features of the algorithm, this array is unordered and connecting the vertices in this order, we get only a partially filled outline (right picture). Is there a way to sort them in such a way that I could only connect them and get a closed path (the holes that are in the filled outline in the left picture shouldn't be a priori, so we don’t have to worry about them)?

            Summing up, due to the not-so-best fill job, I think to use a different algorithm / implementation, but I don’t know which one. Here are some of my ideas:

            1. Use a different implementation, for example, a line scanning method. As far as I know, here is one of the fastest and most effective implementations of the algorithm among open sources. Pros: possible efficiency and speed. Cons: I need to somehow convert the result to a polygon, rewrite the algorithm to javascript (probably emscripten, can do it well, but in any case I will have to rewrite a considerable part of the code).

            2. Use a completely different approach.

              a) I don’t know, but maybe the Canny detector can be useful for extracting the polygon. But as far as the use of the program is meant on the client side, it will be unprofitable to extract all the boundaries, it is necessary to figure out how to process only the necessary section, and not the entire picture.

              b) Then, knowing the border, use any sufficiently fast fill algorithm that simply won't go beyond the boundaries found.

            I'll be glad to know about some other ways, and even better to see ready-made implementations in javascript

            UPD:

            For a better understanding, the tool cursor and the expected result of the algorithm are presented below.

            ...

            ANSWER

            Answered 2020-May-09 at 16:19

            Here is an example with opencv

            Below should work or eventually use the fiddle link provided inside the code snippet

            Of interest: approxPolyDP which may be sufficient for your needs (check Ramer-Douglas-Peucker algorithm)

            Source https://stackoverflow.com/questions/61685407

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install n-dimensional-flood-fill

            You can install using 'npm i n-dimensional-flood-fill' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i n-dimensional-flood-fill

          • CLONE
          • HTTPS

            https://github.com/tuzz/n-dimensional-flood-fill.git

          • CLI

            gh repo clone tuzz/n-dimensional-flood-fill

          • sshUrl

            git@github.com:tuzz/n-dimensional-flood-fill.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Artificial Intelligence Libraries

            Try Top Libraries by tuzz

            game-loop

            by tuzzRust

            ascii_tree

            by tuzzRuby

            bucket_queue

            by tuzzRust

            game-engine

            by tuzzRust