ToSet[img, {r0, c0}] returns the positions of all ones in image img with an origin at the position given by {r0, c0}.
ToSet[img, {r0, c0}, v] returns the position of all pixels equal to v in image img with an origin at the position given by {r0, c0}.