Use a training algorithm to check tolerant results with previously found bugs with higher confidence.
Probable hint: k-nearest neigbor algorithm or support vector machines. OpenCV should provide something to make this easier.
Alternatively, have a look on scikit-learn (which provides e.g. KNN, SVMs and kMEANS).