changed threshold to be based on base image data