added dilation to improve thresholded images