Example #1
0
def calcRobustPointBasedReg(FUPoints, BLPoints):
    """
    using ransac to find inliers
    :param FUPoints:
    :param BLPoints:
    :return:
    """
    f, inlierIdx= utils.ransac(BLPoints,FUPoints,calcPointBasedReg,calcDist,4,100,20,0.1)
    return f, inlierIdx
Example #2
0
 def _spatial_check(self, src_kpt, src_ind, match_list):
     scores = []
     for ind_p, path in enumerate(match_list):
         data_desc, data_kpt = utils.sift('static/' + path, self.args.scale)
         data_ind = np.zeros((1, data_desc.shape[0]))
         for ind, desc in enumerate(data_desc):
             data_ind[0, ind] = self._lookup(desc, 0)
         scores.append(utils.ransac(src_kpt, data_kpt,
                                    np.nonzero(src_ind.T == data_ind)))
         print('Image {:2d} --- {:4d} keypoints matches'.format(
             ind_p + 1, scores[ind_p]), flush=True, end='\r')
     return np.argsort(-1 * np.array(scores))
Example #3
0
def calcRobustPointBasedReg(FUPoints, BLPoints):
    """
    this function computes the rigidREg and the inliers using the ransac function from utils
    :param FUPoints: Follow-Up points
    :param BLPoints: BaseLine points
    :return: rigidReg and indexes of the inliners
    """
    minPtNum = 4
    iterNum = 100
    thDist = 200
    thInlrRatio = 0.5
    rigidReg, inliers = utils.ransac(BLPoints, FUPoints, calcPointBasedReg, calcDist, minPtNum,
                                     iterNum, thDist, thInlrRatio)
    return rigidReg, inliers
    def calcRobustPointBasedReg(self, BLPoints, FUPoints):
        '''
        This function computes the transformation with unknown outliers in the pairs list.
        '''
        # Setup the parameters for ransac
        minPtNum = 3
        iterNum = 100
        thDist = 25
        thInlrRatio = 0.5

        tform, inlieridx = utils.ransac(BLPoints, FUPoints,
                                        self.calcPointBasedReg, self.calcDist,
                                        minPtNum, iterNum, thDist, thInlrRatio)

        return (tform, inlieridx)
Example #5
0
def calcRobustPointBasedReg(fixedPoints, movingPoints):
    '''function get 2 sets of points and get randomaly number of points and calculate the best regid trans.
		when we assume out liers in the matching point and return the min distance in pixels'''
    # we choose 2 from all possibilities of choice and calculate shortes distance, we can choose
    #a 6 or 7 points from the ouliers and randomaly we got the best 5. we choose distance 5 because we know that
    #the maximum of distance limited by 5 pixels from the first set of points.
    minPtNum = 2
    iterNum = misc.comb(len(movingPoints), 2, exact=True)
    print iterNum
    thDist = 5
    thInlrRatio = 0.5
    f, inlierIdx = utils.ransac(fixedPoints, movingPoints, calcPointBasedReg,
                                calcDist, minPtNum, iterNum, thDist,
                                thInlrRatio)

    return f, inlierIdx
Example #6
0
ax2.plot(x_data2, y_data2, 'bo', label='dataset2')
ax2.set(xlabel='x-axis', ylabel='y-axis', title="Dataset 2")
ax2.legend()
# plt.show()


# Plot the output curve fit using the LMSE method.
fig = plt.figure(figsize=(10,5))
(ax1, ax2) = fig.subplots(1, 2)
fig.suptitle('Least Mean Square Output Curve Fit')

ax1.plot(x_data1, y_data1, 'bo', label=' Dataset 1')
ax1.plot(x_data1, utils.predictOutput(x_data1, y_data1, utils.build_Model(x_data1, y_data1)), color='red', label='Curve Fit')
ax1.set(xlabel='x-axis', ylabel='y-axis', title="Dataset 1")
ax1.legend()

ax2.plot(x_data2, y_data2, 'o', label=' Dataset 2')
ax2.plot(x_data2, utils.predictOutput(x_data2, y_data2, utils.build_Model(x_data2, y_data2)), color='red', label='Curve Fit')
ax2.set(xlabel='x-axis', ylabel='y-axis', title="Dataset 2")
ax2.legend()
# plt.show()

# We plot the output curve fit for the first dataset using the RANSAC algorithm.
utils.ransac(x_data1, y_data1, 10000, 45, 95,1)


# We plot the output curve fit for the second dataset using the RANSAC algorithm.
utils.ransac(x_data2, y_data2, 10000, 45, 95,2)

print("Finished Processing Generating Output...")
plt.show()
Example #7
0
def calcRobustPointBasedReg(moving_points, fixed_points):
    f, inlier_index = utils.ransac(fixed_points, moving_points,
                                   calcPointBasedReg, calcDist, 10, 100, 10,
                                   0.01)
    return f, inlier_index