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


Python _regionprops.regionprops函数代码示例

本文整理汇总了Python中skimage.measure._regionprops.regionprops函数的典型用法代码示例。如果您正苦于以下问题:Python regionprops函数的具体用法?Python regionprops怎么用?Python regionprops使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_ndim

def test_ndim():
    regionprops(np.zeros((10, 10), dtype=np.int))
    regionprops(np.zeros((10, 10, 1), dtype=np.int))
    regionprops(np.zeros((10, 10, 1, 1), dtype=np.int))
    regionprops(np.zeros((10, 10, 10), dtype=np.int))
    with pytest.raises(TypeError):
        regionprops(np.zeros((10, 10, 10, 2), dtype=np.int))
开发者ID:andreydung,项目名称:scikit-image,代码行数:7,代码来源:test_regionprops.py

示例2: test_dtype

def test_dtype():
    regionprops(np.zeros((10, 10), dtype=np.int))
    regionprops(np.zeros((10, 10), dtype=np.uint))
    assert_raises((TypeError), regionprops,
                  np.zeros((10, 10), dtype=np.float))
    assert_raises((TypeError), regionprops,
                  np.zeros((10, 10), dtype=np.double))
开发者ID:budihartadi,项目名称:scikit-image,代码行数:7,代码来源:test_regionprops.py

示例3: test_filled_area

def test_filled_area():
    area = regionprops(SAMPLE)[0].filled_area
    assert area == np.sum(SAMPLE)

    SAMPLE_mod = SAMPLE.copy()
    SAMPLE_mod[7, -3] = 0
    area = regionprops(SAMPLE_mod)[0].filled_area
    assert area == np.sum(SAMPLE)
开发者ID:cdeil,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例4: test_bbox

def test_bbox():
    bbox = regionprops(SAMPLE, ['BoundingBox'])[0]['BoundingBox']
    assert_array_almost_equal(bbox, (0, 0, SAMPLE.shape[0], SAMPLE.shape[1]))

    SAMPLE_mod = SAMPLE.copy()
    SAMPLE_mod[:, -1] = 0
    bbox = regionprops(SAMPLE_mod, ['BoundingBox'])[0]['BoundingBox']
    assert_array_almost_equal(bbox, (0, 0, SAMPLE.shape[0], SAMPLE.shape[1]-1))
开发者ID:ChrisBeaumont,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例5: test_iterate_all_props

def test_iterate_all_props():
    region = regionprops(SAMPLE)[0]
    p0 = dict((p, region[p]) for p in region)

    region = regionprops(SAMPLE, intensity_image=INTENSITY_SAMPLE)[0]
    p1 = dict((p, region[p]) for p in region)

    assert len(p0) < len(p1)
开发者ID:budihartadi,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例6: test_eccentricity

def test_eccentricity():
    eps = regionprops(SAMPLE)[0].eccentricity
    assert_almost_equal(eps, 0.814629313427)

    img = np.zeros((5, 5), dtype=np.int)
    img[2, 2] = 1
    eps = regionprops(img)[0].eccentricity
    assert_almost_equal(eps, 0)
开发者ID:cdeil,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例7: test_filled_area

def test_filled_area():
    area = regionprops(SAMPLE, ['FilledArea'])[0]['FilledArea']
    assert area == np.sum(SAMPLE)

    SAMPLE_mod = SAMPLE.copy()
    SAMPLE_mod[7, -3] = 0
    area = regionprops(SAMPLE_mod, ['FilledArea'])[0]['FilledArea']
    assert area == np.sum(SAMPLE)
开发者ID:ChrisBeaumont,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例8: test_euler_number

def test_euler_number():
    en = regionprops(SAMPLE, ['EulerNumber'])[0]['EulerNumber']
    assert en == 0

    SAMPLE_mod = SAMPLE.copy()
    SAMPLE_mod[7, -3] = 0
    en = regionprops(SAMPLE_mod, ['EulerNumber'])[0]['EulerNumber']
    assert en == -1
开发者ID:ChrisBeaumont,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例9: test_euler_number

def test_euler_number():
    en = regionprops(SAMPLE)[0].euler_number
    assert en == 0

    SAMPLE_mod = SAMPLE.copy()
    SAMPLE_mod[7, -3] = 0
    en = regionprops(SAMPLE_mod)[0].euler_number
    assert en == -1
开发者ID:cdeil,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例10: test_bbox

def test_bbox():
    bbox = regionprops(SAMPLE)[0].bbox
    assert_array_almost_equal(bbox, (0, 0, SAMPLE.shape[0], SAMPLE.shape[1]))

    SAMPLE_mod = SAMPLE.copy()
    SAMPLE_mod[:, -1] = 0
    bbox = regionprops(SAMPLE_mod)[0].bbox
    assert_array_almost_equal(bbox, (0, 0, SAMPLE.shape[0], SAMPLE.shape[1]-1))
开发者ID:cdeil,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py

示例11: test_euler_number

def test_euler_number():
    with expected_warnings(['`background`|CObject type']):
        en = regionprops(SAMPLE)[0].euler_number
    assert en == 0

    SAMPLE_mod = SAMPLE.copy()
    SAMPLE_mod[7, -3] = 0
    with expected_warnings(['`background`|CObject type']):
        en = regionprops(SAMPLE_mod)[0].euler_number
    assert en == -1
开发者ID:MartinSavc,项目名称:scikit-image,代码行数:10,代码来源:test_regionprops.py

示例12: test_coordinates

def test_coordinates():
    sample = np.zeros((10, 10), dtype=np.int8)
    coords = np.array([[3, 2], [3, 3], [3, 4]])
    sample[coords[:, 0], coords[:, 1]] = 1
    prop_coords = regionprops(sample)[0].coords
    assert_array_equal(prop_coords, coords)

    sample = np.zeros((6, 6, 6), dtype=np.int8)
    coords = np.array([[1, 1, 1], [1, 2, 1], [1, 3, 1]])
    sample[coords[:, 0], coords[:, 1], coords[:, 2]] = 1
    prop_coords = regionprops(sample)[0].coords
    assert_array_equal(prop_coords, coords)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:12,代码来源:test_regionprops.py

示例13: test_dtype

def test_dtype():
    regionprops(np.zeros((10, 10), dtype=np.int))
    regionprops(np.zeros((10, 10), dtype=np.uint))
    with pytest.raises(TypeError):
        regionprops(np.zeros((10, 10), dtype=np.float))
    with pytest.raises(TypeError):
        regionprops(np.zeros((10, 10), dtype=np.double))
开发者ID:andreydung,项目名称:scikit-image,代码行数:7,代码来源:test_regionprops.py

示例14: test_equals

def test_equals():
    arr = np.zeros((100, 100), dtype=np.int)
    arr[0:25, 0:25] = 1
    arr[50:99, 50:99] = 2

    regions = regionprops(arr)
    r1 = regions[0]

    regions = regionprops(arr)
    r2 = regions[0]
    r3 = regions[1]

    assert_equal(r1 == r2, True, "Same regionprops are not equal")
    assert_equal(r1 != r3, True, "Different regionprops are equal")
开发者ID:budihartadi,项目名称:scikit-image,代码行数:14,代码来源:test_regionprops.py

示例15: test_equals

def test_equals():
    arr = np.zeros((100, 100), dtype=np.int)
    arr[0:25, 0:25] = 1
    arr[50:99, 50:99] = 2

    regions = regionprops(arr)
    r1 = regions[0]

    regions = regionprops(arr)
    r2 = regions[0]
    r3 = regions[1]

    with expected_warnings(['`background`|CObject type']):
        assert_equal(r1 == r2, True, "Same regionprops are not equal")
        assert_equal(r1 != r3, True, "Different regionprops are equal")
开发者ID:MartinSavc,项目名称:scikit-image,代码行数:15,代码来源:test_regionprops.py


注:本文中的skimage.measure._regionprops.regionprops函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。