import numpy as np
import cv2


class Ransac(object):
    def __init__(self, data):
        self.data = data

    def __good_pts(self, kps, mps):
        rr = [kps[m].pt for m in mps]
        return np.float32(rr).reshape(-1, 1, 2)

    def __compute(self, good, skp, vkp, min_matches=10):
        """
        data is a dict contained columns:
        [ 'kp_train', 'kp_test', 'matches']
        Methods:
          0 - a regular method using all the points
          CV_RANSAC - RANSAC-based robust method
          CV_LMEDS - Least-Median robust method
        """
        if len(good) >= min_matches:
            src = self.__good_pts(skp, good.qix)
            des = self.__good_pts(vkp, good.tix)
            M, mask = cv2.\
                findHomography(src, des,
                               method=cv2.RANSAC,
                               ransacReprojThreshold=5.0)
            return M, mask
        return None

    def compute(self, min_matches=10):
        good = self.data['matches']
        skp = self.data['sif']['kps']
        fkp = self.data['vif']['kps']
        return self.__compute(good, skp, fkp, min_matches=min_matches)

@@ -917,16 +917,22 @@
 urn None
+, None
 %0A%0A    de
@@ -1084,22 +1084,25 @@
         
-return
+M, mask =
  self.__
@@ -1150,8 +1150,69 @@
 atches)%0A
+        self.data%5B'matches'%5D%5B'keep'%5D = mask%0A        return M%0A

Make ransac filter return filtered(keep) result in matches dataframe #20