コード例 #1
0
def relative_pose_ransac_rotation_only(b1, b2, threshold, iterations,
                                       probability):
    try:
        return pyopengv.relative_pose_ransac_rotation_only(
            b1, b2, threshold, iterations=iterations, probability=probability)
    except Exception:
        # Older versions of pyopengv do not accept the probability argument.
        return pyopengv.relative_pose_ransac_rotation_only(
            b1, b2, threshold, iterations)
コード例 #2
0
ファイル: multiview.py プロジェクト: mapillary/OpenSfM
def relative_pose_ransac_rotation_only(b1, b2, threshold, iterations,
                                       probability):
    try:
        return pyopengv.relative_pose_ransac_rotation_only(
            b1, b2, threshold,
            iterations=iterations,
            probability=probability)
    except Exception:
        # Older versions of pyopengv do not accept the probability argument.
        return pyopengv.relative_pose_ransac_rotation_only(
            b1, b2, threshold, iterations)
コード例 #3
0
def test_relative_pose_ransac_rotation_only():
    print("Testing relative pose ransac rotation only")

    d = RelativePoseDataset(100, 0.0, 0.3, rotation_only=True)

    ransac_rotation = pyopengv.relative_pose_ransac_rotation_only(
        d.bearing_vectors1, d.bearing_vectors2, 0.01, 1000)

    assert proportional(d.rotation, ransac_rotation)

    print("Done testing relative pose ransac rotation only")
コード例 #4
0
ファイル: tests.py プロジェクト: AhmadZakaria/opengv
def test_relative_pose_ransac_rotation_only():
    print "Testing relative pose ransac rotation only"

    d = RelativePoseDataset(100, 0.0, 0.3, rotation_only=True)

    ransac_rotation = pyopengv.relative_pose_ransac_rotation_only(
        d.bearing_vectors1, d.bearing_vectors2, 0.01, 1000)

    assert proportional(d.rotation, ransac_rotation)

    print "Done testing relative pose ransac rotation only"
コード例 #5
0
ファイル: reconstruction.py プロジェクト: imclab/OpenSfM
def two_view_reconstruction_rotation_only(p1, p2, camera1, camera2, threshold):
    b1 = camera1.pixel_bearings(p1)
    b2 = camera2.pixel_bearings(p2)
    t = np.zeros(3)

    R = pyopengv.relative_pose_ransac_rotation_only(b1, b2, 1 - np.cos(threshold), 1000)
    inliers = _two_view_reconstruction_rotation_only_inliers(b1, b2, R, threshold)

    # R = pyopengv.relative_pose_rotation_only(b1[inliers], b2[inliers])
    # inliers = _two_view_reconstruction_rotation_only_inliers(b1, b2, R, threshold)

    return cv2.Rodrigues(R.T)[0].ravel(), inliers
コード例 #6
0
def test_relative_pose_ransac_rotation_only():
    print("Testing relative pose ransac rotation only")

    d = RelativePoseDataset(100, 0.0, 0.3, rotation_only=True)

    ransac_rotation, inliers = pyopengv.relative_pose_ransac_rotation_only(
        d.bearing_vectors1, d.bearing_vectors2, 0.01, 1000, 0.99, True)
    print('Inliers: {} out of {}'.format(len(inliers), 100))

    assert proportional(d.rotation, ransac_rotation)

    print("Done testing relative pose ransac rotation only")
コード例 #7
0
def two_view_reconstruction_rotation_only(p1, p2, camera1, camera2, threshold):
    b1 = camera1.pixel_bearings(p1)
    b2 = camera2.pixel_bearings(p2)
    t = np.zeros(3)

    R = pyopengv.relative_pose_ransac_rotation_only(b1, b2, 1 - np.cos(threshold), 1000)
    inliers = _two_view_reconstruction_rotation_only_inliers(b1, b2, R, threshold)

    # R = pyopengv.relative_pose_rotation_only(b1[inliers], b2[inliers])
    # inliers = _two_view_reconstruction_rotation_only_inliers(b1, b2, R, threshold)

    return cv2.Rodrigues(R.T)[0].ravel(), inliers
コード例 #8
0
ファイル: multiview.py プロジェクト: weiniuzhu/OpenSfM
def relative_pose_ransac_rotation_only(b1, b2, threshold, iterations,
                                       probability):
    # in-house estimation
    if in_house_multiview:
        threshold = np.arccos(1 - threshold)
        params = pyrobust.RobustEstimatorParams()
        params.iterations = 1000
        result = pyrobust.ransac_relative_rotation(b1, b2, threshold, params,
                                                   pyrobust.RansacType.RANSAC)
        return result.lo_model.T
    else:
        try:
            return pyopengv.relative_pose_ransac_rotation_only(
                b1,
                b2,
                threshold,
                iterations=iterations,
                probability=probability)
        except Exception:
            # Older versions of pyopengv do not accept the probability argument.
            return pyopengv.relative_pose_ransac_rotation_only(
                b1, b2, threshold, iterations)
コード例 #9
0
ファイル: reconstruction.py プロジェクト: gy20073/OpenSfM
def two_view_reconstruction_rotation_only(p1, p2, camera1, camera2, threshold):
    """Find rotation between two views from point correspondences.

    Args:
        p1, p2: lists points in the images
        camera1, camera2: Camera models
        threshold: reprojection error threshold

    Returns:
        rotation and inlier list
    """
    b1 = camera1.pixel_bearings(p1)
    b2 = camera2.pixel_bearings(p2)

    R = pyopengv.relative_pose_ransac_rotation_only(
        b1, b2, 1 - np.cos(threshold), 1000)
    inliers = _two_view_rotation_inliers(b1, b2, R, threshold)

    return cv2.Rodrigues(R.T)[0].ravel(), inliers
コード例 #10
0
ファイル: reconstruction.py プロジェクト: htmlfusion/OpenSfM
def two_view_reconstruction_rotation_only(p1, p2, camera1, camera2, threshold):
    """Find rotation between two views from point correspondences.

    Args:
        p1, p2: lists points in the images
        camera1, camera2: Camera models
        threshold: reprojection error threshold

    Returns:
        rotation and inlier list
    """
    b1 = camera1.pixel_bearings(p1)
    b2 = camera2.pixel_bearings(p2)

    R = pyopengv.relative_pose_ransac_rotation_only(
        b1, b2, 1 - np.cos(threshold), 1000)
    inliers = _two_view_rotation_inliers(b1, b2, R, threshold)

    return cv2.Rodrigues(R.T)[0].ravel(), inliers