This is how Paint's bucket fill works (Flood fill algorithm)

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

Комментарии • 74

  • @insidecode
    @insidecode  Год назад +3

    Discover the new graph theory algorithms course: inscod.com/graphalgo
    🔴
    / \
    🔵-🔴
    | |
    🔴-🔵

  • @szilardbenyovszky5075
    @szilardbenyovszky5075 Год назад +5

    Man you deserve more recognition. I went from hopless to implementing flood fill into my command like paint project in 9 minutes. Thanks :)

  • @alexromero3274
    @alexromero3274 3 года назад +31

    I'm a visual learner and your videos are SO helpful! I appreciate it! Thank you :-)

    • @insidecode
      @insidecode  3 года назад

      You're welcome!

    • @nishaindesilva3738
      @nishaindesilva3738 2 года назад +1

      yup me too....videos are very self-explanatory compared to long scrolling websites

  • @csaki01
    @csaki01 Год назад +2

    Thank you! This was exactly the 8 minute video I needed to learn about flood fill algorithms for today's job.

  • @TABandiTA
    @TABandiTA 5 месяцев назад +5

    Thanks a lot. We need more non-indian math/coding youtubers.

  • @udaykulkarni5639
    @udaykulkarni5639 Месяц назад

    1 min in the video and subscribed already!! Good stuff man

  • @florinmatei8846
    @florinmatei8846 3 года назад +3

    If we would use a sorted stack (function of Manhattan Distance from current pixel to the seed one) we might find it useful for maintaining the "shape factor" of current filled zone which is meant for using less working memory data. Also, there could be some "memory data write protection" for the same purpose. These as some start point for further algo features to be added.

    • @florinmatei8846
      @florinmatei8846 3 года назад

      If the memory data used for the sorted stack kinda needs circulary overwrite, then we might use , first, some data sampling, probabily the shape factor will work pretty well in this case , either

    • @insidecode
      @insidecode  2 года назад +1

      Interesting remarks

    • @florinmatei8846
      @florinmatei8846 2 года назад

      @@insidecode Thank You very much! You are very kind.

  • @hangkikuta6786
    @hangkikuta6786 2 года назад +1

    This is a GOD SEND to me to prepare for my exam. Thank you!

  • @panjak323
    @panjak323 4 месяца назад +1

    Shouldn't you start with right cell search to optimize memory access though ?

  • @Scar32
    @Scar32 Месяц назад

    DFS looks like it's a good algorithm for a pen plotter fill algorithm like the way it snakes across the image to fill it is just wonderful!

  • @nishaindesilva3738
    @nishaindesilva3738 2 года назад +2

    I thank you a lot, the second recommended method works well in my android app. Compared to other method, this technique has no nested loop and less overload. Bravos !

    • @insidecode
      @insidecode  2 года назад

      You're welcome!

    • @cicik57
      @cicik57 2 года назад

      @@insidecode you can improve the algorithm by drawing not by point by point, but entire line - until it hits borders and then go to the next line what is near. Maybe you will make do tutorial about that.

  • @tanvirahmed3715
    @tanvirahmed3715 3 года назад +2

    Wonderful explanation, flood fill was blurred to me until now. Thanks

  • @will-gama
    @will-gama 3 месяца назад

    Fantastic explanation, well done

  • @manpt123
    @manpt123 2 года назад +2

    Sir thank you so much for making the algorithms easy and visuable for us.

  • @richardpro8927
    @richardpro8927 3 месяца назад

    Awesome ❤ amazing visualisation loved it and moreover understand the dreaded BFS/DFS
    THANKS A TON

  • @anhduc0913
    @anhduc0913 6 месяцев назад

    How did you make videos like this? This is very informative and is great for visualising algorithms while also explaining the coding for it.

  • @rahulkaushal2985
    @rahulkaushal2985 3 года назад +6

    Best explanation of the problem thanks sir for clear my doubts 🤩🤩

  • @Samimies
    @Samimies Год назад

    Thanks a lot! I was wondering why my floodfill wasn't working like it should. It turned out that it was because the logic was DFS no BFS.

  • @iwormix6844
    @iwormix6844 2 года назад +1

    Hmm, recently i have implemented this algorithm to find the differences between two pictures, and visualize them, I didn't even know, that it has "Flood fill" name :)

  • @afadeevz
    @afadeevz Год назад

    Space complexity for BFS is O(n + m)

  • @Lycam
    @Lycam 2 года назад +2

    Dont use recursion, instead use a Stack or a Queue with a loop.
    With recursion you let the program use its own stack and it has a small limit.

    • @rutabega306
      @rutabega306 Год назад

      Not that small tbh. Recursion is fine for reasonably sized canvas

  • @sushismitcher225
    @sushismitcher225 Год назад

    the indentation on your github page is broken. Good helpful tutorial!

  • @jenniferfan8155
    @jenniferfan8155 9 месяцев назад

    Best explanation ever!

  • @prashanthpremakumar6637
    @prashanthpremakumar6637 3 года назад +5

    this was really great!!!!

  • @SimpleLivingHigherThinking
    @SimpleLivingHigherThinking 10 месяцев назад

    Cool way of learning computer graphics I was finding it boring to read from other channels

  • @pingpong-kv6eq
    @pingpong-kv6eq 7 месяцев назад

    Thanks you man that was really well shown

  • @Alien426
    @Alien426 3 года назад

    Just what I needed. Thanks.
    The only gripe I have is with the variable names:
    @6:00 n, m, i, j are not descriptive at all. I would rename "m" to "iWide", "n" to "iHigh", "i" to "iRow", "j" to "iCol"/"iColumn". I know the variable names are better @7:30, but one will run out of single letter names pretty fast. In my opinion it's better to type a little more and be clearer than to save a few keyboard strokes.
    I like to use Hungarian notation with a single letter for the type (in Python: bVar for boolean, iVar for integer, fVar for float, lVar for list, tVar for tuple, ...), but I guess it's out of fashion for some reason.

    • @insidecode
      @insidecode  3 года назад +2

      I think that n, m, i and j are the standard variable names when dealing with matrices, where n and m are the dimensions (rows and columns respectively) and i and j the coordinates of the actual cell

  • @ayt_daily
    @ayt_daily 3 года назад

    That's awesome. Thank you!!
    Besides, is the magic wand tool method the same as this? can you explain later?

    • @insidecode
      @insidecode  3 года назад

      You're welcome! Yes magic wand tool uses flood fill, it keeps expanding until it finds pixels with whom the difference is higher than the tolerance. I'll try to make a video on it

    • @ayt_daily
      @ayt_daily 3 года назад

      @@insidecode Yes thank you, i'll wait :D

  • @ThibJoker
    @ThibJoker 2 года назад

    Just what I needed, thank you !

  • @소금냠냠
    @소금냠냠 3 года назад

    It’s so wonderful. Thank your uploading!

  • @TheDarknessDragon
    @TheDarknessDragon 3 года назад +1

    Hey, yes you have improved a lot from before. Now I can pinpoint the only issue you have cuz you are overall so much more clear in your speech now. It's the way you pronounce words with the alphabet 'O'. Okay lemme try, see when we pronounce a word that has an 'O' in it, like the word - 'word' itself => our lower lip only moves (kinda) but when you are speaking this word, you put too much pressure where the alphabet 'O' is. (Try not to change your intonation too much and maybe just here and there but just a little so that it doesn't sound robotic. I had issues in speaking in monotone and had to learn it the hard way lol)
    This is just an example for this word. It's not a rule that every word with an 'O' will only use the lower lip. But it makes it a lot clear when we don't put too much pressure in any specific alphabet. Different languages pronounce the English language in a different way due to which we have so many accents. But a common thing in all the accents that are easy to understand => they don't apply pressure to specific alphabets.
    Once again, just trying to help if all this explanation makes sense. Your knowledge and way of teaching is excellent. All the best mate!
    Edit - Oh and this one was the best video by far. I had doubts in this one too but it's all clear now. Thanks!

    • @insidecode
      @insidecode  3 года назад

      Thanks for this detailed feedback! Sure it's gonna help me improve

  • @procode6881
    @procode6881 3 года назад +1

    Wonderful,great explaination man

  • @arsenbabaev1022
    @arsenbabaev1022 3 года назад

    Wow, calculating islands or biomes is exactly what I was looking for. It will come out soon? or already did

  • @charlescampista9384
    @charlescampista9384 2 года назад

    Very well explained! Thanks!

  • @AryanK1511
    @AryanK1511 11 месяцев назад

    What an amazing video

  • @francescopiazza4882
    @francescopiazza4882 2 года назад

    Many thanks, pal !

  • @GameplayDexter
    @GameplayDexter 3 года назад

    Hello, Is there any way someone could send me a copy of this when the code is working with pygame (BFS version), as I have trouble implementing the source code linked under the video.? If yes, thank you!

  • @gettykung1185
    @gettykung1185 Год назад

    Thank you!

  • @Jana-vv5qx
    @Jana-vv5qx Год назад

    Very nice code

  • @leilaborromeo
    @leilaborromeo 3 года назад +1

    your videos are so helpful :)

  • @gamermoneyfree8193
    @gamermoneyfree8193 3 года назад +1

    I'm getting recursive limits exceed in python while implementing

    • @insidecode
      @insidecode  3 года назад

      How much is the size of your grid?

    • @gamermoneyfree8193
      @gamermoneyfree8193 3 года назад

      @@insidecode my circle radius is 50 but for smaller radius circle it works
      Is there any way to run it on large radius size without getting error

    • @insidecode
      @insidecode  3 года назад +1

      @@gamermoneyfree8193 you can modify the recursion limit with sys.setrecursionlimit, or you can use BFS instead of DFS to avoid recursion

    • @gamermoneyfree8193
      @gamermoneyfree8193 3 года назад

      @@insidecode ty for response

    • @insidecode
      @insidecode  3 года назад +1

      @@gamermoneyfree8193 you're welcomee

  • @prernagolani9014
    @prernagolani9014 2 года назад

    very nice video

  • @samarthtandale9121
    @samarthtandale9121 3 года назад +1

    Made the 200'th like 😁

  • @rahulsingh-cn7dv
    @rahulsingh-cn7dv 3 года назад

    Thankyou so much..... !

  • @definite_d
    @definite_d 10 месяцев назад

    1000th like. Great video.

  • @adamekhobba2156
    @adamekhobba2156 8 месяцев назад

    🟥🟩

  • @Kyoz
    @Kyoz 4 месяца назад

    🤍