本文整理汇总了Python中skimage.measure._regionprops.regionprops函数的典型用法代码示例。如果您正苦于以下问题:Python regionprops函数的具体用法?Python regionprops怎么用?Python regionprops使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了regionprops函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: test_all_props_3d
def test_all_props_3d():
region = regionprops(SAMPLE_3D, INTENSITY_SAMPLE_3D)[0]
for prop in PROPS:
try:
assert_almost_equal(region[prop], getattr(region, PROPS[prop]))
except NotImplementedError:
pass
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:7,代码来源:test_regionprops.py
示例17: _measure_properties
def _measure_properties(self, z, metadata, p=25):
from skimage.measure._regionprops import regionprops
nim = z.copy()
# nz = z[z > min(z) * 3]
# for zi in z:
# print zi
mz = min(z)
r = max(z) - mz
t = p * 0.01 * r + mz
# print 'aaaa', max(z), min(z)
# print 'bbbb', t, p
# t2 = percentile(nz, p)
# t = percentile(z, p)
# print 'nz ', t2, 'z ', t1
nim[z < t] = 0
props = None
try:
props = regionprops(nim.astype(int), ['EquivDiameter', 'Centroid',
'MajorAxisLength', 'MinorAxisLength',
'Orientation'
])
except TypeError as e:
pass
return props, nim
开发者ID:NMGRL,项目名称:pychron,代码行数:28,代码来源:power_map_processor.py
示例18: test_invalid
def test_invalid():
ps = regionprops(SAMPLE)
def get_intensity_image():
ps[0].intensity_image
assert_raises(AttributeError, get_intensity_image)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:7,代码来源:test_regionprops.py
示例19: test_invalid
def test_invalid():
ps = regionprops(SAMPLE)
def get_intensity_image():
ps[0].intensity_image
with pytest.raises(AttributeError):
get_intensity_image()
开发者ID:andreydung,项目名称:scikit-image,代码行数:8,代码来源:test_regionprops.py
示例20: test_moments_normalized
def test_moments_normalized():
nu = regionprops(SAMPLE)[0].moments_normalized
# determined with OpenCV
assert_almost_equal(nu[0,2], 0.08410493827160502)
assert_almost_equal(nu[1,1], -0.016846707818929982)
assert_almost_equal(nu[1,2], -0.002899800614433943)
assert_almost_equal(nu[2,0], 0.24301268861454037)
assert_almost_equal(nu[2,1], 0.045473992910668816)
assert_almost_equal(nu[3,0], -0.017278118992041805)
开发者ID:cdeil,项目名称:scikit-image,代码行数:9,代码来源:test_regionprops.py
注:本文中的skimage.measure._regionprops.regionprops函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论