title: pixel tracing not working properly
body: <p>so i got an image with a curve, and i got a function that looks for 1 pixel and then connect the adjacent pixels (like forming a path), but somehow when it is going south-west or west it does not find any pixels even if there is one.</p>
  
  <p>the function goes like:</p>
  
  <pre><code>    pixels=img.getpixels()
      window=((1,0),(0,-1),(-1,0),(0,1),(1,1),(1,-1),(-1,-1),(-1,1))
      objs=[]
      obj=[pixels.pop(),]    
      while pixels:
              p=obj[-1]
              neighbours=tuple((x+p[0],y+p[1]) for x,y in window)
              for n in neighbours:
                      if n in pixels:
                          obj.append(n)
                          pixels.remove(n)
                          break
              if p==obj[-1]:
                  objs.append(obj)
                  obj=[pixels.pop(),]
  </code></pre>
  
  <p>and an example of the failure:</p>
  
  <p><a href="https://i.stack.imgur.com/sw9dH.png" rel="nofollow noreferrer">the original image</a></p>
  
  <p><a href="https://i.stack.imgur.com/nvdnk.png" rel="nofollow noreferrer">the objects image</a></p>
  
  <p>each different color represents a different "object"
  should it not be showing just one object?</p>
  
  <p>i appreciate any thoughts on this, tyvm :D</p>