added the ability to change an image into a binary image given some threshold