当前位置: 首页>>代码示例>>Python>>正文


Python CircleModel.params方法代码示例

本文整理汇总了Python中skimage.measure.CircleModel.params方法的典型用法代码示例。如果您正苦于以下问题:Python CircleModel.params方法的具体用法?Python CircleModel.params怎么用?Python CircleModel.params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在skimage.measure.CircleModel的用法示例。


在下文中一共展示了CircleModel.params方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_circle_model_residuals

# 需要导入模块: from skimage.measure import CircleModel [as 别名]
# 或者: from skimage.measure.CircleModel import params [as 别名]
def test_circle_model_residuals():
    model = CircleModel()
    model.params = (0, 0, 5)
    assert_almost_equal(abs(model.residuals(np.array([[5, 0]]))), 0)
    assert_almost_equal(abs(model.residuals(np.array([[6, 6]]))),
                        np.sqrt(2 * 6**2) - 5)
    assert_almost_equal(abs(model.residuals(np.array([[10, 0]]))), 5)
开发者ID:noahstier,项目名称:scikit-image,代码行数:9,代码来源:test_fit.py

示例2: test_circle_model_predict

# 需要导入模块: from skimage.measure import CircleModel [as 别名]
# 或者: from skimage.measure.CircleModel import params [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

示例3: test_circle_model_estimate

# 需要导入模块: from skimage.measure import CircleModel [as 别名]
# 或者: from skimage.measure.CircleModel import params [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

示例4: test_ransac_shape

# 需要导入模块: from skimage.measure import CircleModel [as 别名]
# 或者: from skimage.measure.CircleModel import params [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.params方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。