當前位置: 首頁>>代碼示例>>Python>>正文


Python CircleModel.predict_xy方法代碼示例

本文整理匯總了Python中skimage.measure.CircleModel.predict_xy方法的典型用法代碼示例。如果您正苦於以下問題:Python CircleModel.predict_xy方法的具體用法?Python CircleModel.predict_xy怎麽用?Python CircleModel.predict_xy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在skimage.measure.CircleModel的用法示例。


在下文中一共展示了CircleModel.predict_xy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_circle_model_predict

# 需要導入模塊: from skimage.measure import CircleModel [as 別名]
# 或者: from skimage.measure.CircleModel import predict_xy [as 別名]
def test_circle_model_predict():
    model = CircleModel()
    r = 5
    model.params = (0, 0, r)
    t = np.arange(0, 2 * np.pi, np.pi / 2)

    xy = np.array(((5, 0), (0, 5), (-5, 0), (0, -5)))
    assert_almost_equal(xy, model.predict_xy(t))
開發者ID:noahstier,項目名稱:scikit-image,代碼行數:10,代碼來源:test_fit.py

示例2: test_circle_model_estimate

# 需要導入模塊: from skimage.measure import CircleModel [as 別名]
# 或者: from skimage.measure.CircleModel import predict_xy [as 別名]
def test_circle_model_estimate():
    # generate original data without noise
    model0 = CircleModel()
    model0.params = (10, 12, 3)
    t = np.linspace(0, 2 * np.pi, 1000)
    data0 = model0.predict_xy(t)

    # add gaussian noise to data
    random_state = np.random.RandomState(1234)
    data = data0 + random_state.normal(size=data0.shape)

    # estimate parameters of noisy data
    model_est = CircleModel()
    model_est.estimate(data)

    # test whether estimated parameters almost equal original parameters
    assert_almost_equal(model0.params, model_est.params, 1)
開發者ID:noahstier,項目名稱:scikit-image,代碼行數:19,代碼來源:test_fit.py

示例3: test_ransac_shape

# 需要導入模塊: from skimage.measure import CircleModel [as 別名]
# 或者: from skimage.measure.CircleModel import predict_xy [as 別名]
def test_ransac_shape():
    # generate original data without noise
    model0 = CircleModel()
    model0.params = (10, 12, 3)
    t = np.linspace(0, 2 * np.pi, 1000)
    data0 = model0.predict_xy(t)

    # add some faulty data
    outliers = (10, 30, 200)
    data0[outliers[0], :] = (1000, 1000)
    data0[outliers[1], :] = (-50, 50)
    data0[outliers[2], :] = (-100, -10)

    # estimate parameters of corrupted data
    model_est, inliers = ransac(data0, CircleModel, 3, 5,
                                random_state=1)

    # test whether estimated parameters equal original parameters
    assert_equal(model0.params, model_est.params)
    for outlier in outliers:
        assert outlier not in inliers
開發者ID:noahstier,項目名稱:scikit-image,代碼行數:23,代碼來源:test_fit.py


注:本文中的skimage.measure.CircleModel.predict_xy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。