Improved the processImage part of the algorithm. The algorithm now used an adaptive threshold method to threshold the image.