We can extend the idea of outlier rejection to every step in the computation. The goal then becomes minimizing the workload while maximizing the likelihood that the result we obtain is a good one.
The resulting procedure for early outlier detection and rejection is embedded in the FeatureMatching.match method. This method first converts the image to grayscale and stores its shape:
def match(self, frame): # create a working copy (grayscale) of the frame # and store its shape for convenience img_query = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) sh_query = img_query.shape # rows,cols
Then, if the outlier is detected during any step of the computation, we raise an Outlier exception to terminate ...