Simple object recognition

前端 未结 5 1219
醉梦人生
醉梦人生 2020-12-24 00:07

===SOLVED===

Thanks for your suggestions and comments. By working on the flood_fill algorithm given in Beginning Python Visualization book (Chapter

5条回答
  •  爱一瞬间的悲伤
    2020-12-24 00:26

    1. Scan every square (e.g. from the top-left, left-to-right, top-to-bottom)

    2. When you hit a blue square then:

      a. Record this square as a location of a new object

      b. Find all the other contiguous blue squares (e.g. by looking at the neighbours of this square, and the neighbours of those neighbours, etc.) and mark them as being part of the same object

    3. Continue to scan

    4. When you find another blue square, test to see whether it's part of a known object before going to step 2; alternatively in step 2b, erase any square after you've associated it with an object

提交回复
热议问题