edit: according to comment by korhner (which is totally right). only add to stack if the color is different then target color.
original post: Adding all pixels on screen to the stack should be fine. I think the problem might be you have overlapping points.
In a similar way of a recursive solution you must know which point is already in the stack and not adding it again.
You might need to use additional data structure for that.