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


Python data.moon函数代码示例

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


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

示例1: test_plot_plugin

def test_plot_plugin():
    viewer = ImageViewer(data.moon())
    plugin = PlotPlugin(image_filter=lambda x: x)
    viewer += plugin

    assert_equal(viewer.image, data.moon())
    plugin._update_original_image(data.coins())
    assert_equal(viewer.image, data.coins())
    viewer.close()
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:9,代码来源:test_plugins.py

示例2: test_paint_tool

def test_paint_tool():
    img = data.moon()
    viewer = ImageViewer(img)

    tool = PaintTool(viewer, img.shape)

    tool.radius = 10
    assert_equal(tool.radius, 10)
    tool.label = 2
    assert_equal(tool.label, 2)
    assert_equal(tool.shape, img.shape)

    do_event(viewer, 'mouse_press', xdata=100, ydata=100)
    do_event(viewer, 'move', xdata=110, ydata=110)
    do_event(viewer, 'mouse_release')

    assert_equal(tool.overlay[tool.overlay == 2].size, 761)

    tool.label = 5
    do_event(viewer, 'mouse_press', xdata=20, ydata=20)
    do_event(viewer, 'move', xdata=40, ydata=40)
    do_event(viewer, 'mouse_release')

    assert_equal(tool.overlay[tool.overlay == 5].size, 881)
    assert_equal(tool.overlay[tool.overlay == 2].size, 761)

    do_event(viewer, 'key_press', key='enter')

    tool.overlay = tool.overlay * 0
    assert_equal(tool.overlay.sum(), 0)
开发者ID:AlexG31,项目名称:scikit-image,代码行数:30,代码来源:test_tools.py

示例3: mono_check

def mono_check(plugin, fmt='png'):
    """Check the roundtrip behavior for images that support most types.

    All major input types should be handled.
    """

    img = img_as_ubyte(data.moon())
    r1 = roundtrip(img, plugin, fmt)
    testing.assert_allclose(img, r1)

    img2 = img > 128
    r2 = roundtrip(img2, plugin, fmt)
    testing.assert_allclose(img2.astype(np.uint8), r2)

    img3 = img_as_float(img)
    r3 = roundtrip(img3, plugin, fmt)
    if r3.dtype.kind == 'f':
        testing.assert_allclose(img3, r3)
    else:
        testing.assert_allclose(r3, img_as_uint(img))

    img4 = img_as_int(img)
    if fmt.lower() in (('tif', 'tiff')):
        img4 -= 100
        r4 = roundtrip(img4, plugin, fmt)
        testing.assert_allclose(r4, img4)
    else:
        r4 = roundtrip(img4, plugin, fmt)
        testing.assert_allclose(r4, img_as_uint(img4))

    img5 = img_as_uint(img)
    r5 = roundtrip(img5, plugin, fmt)
    testing.assert_allclose(r5, img5)
开发者ID:JeanKossaifi,项目名称:scikit-image,代码行数:33,代码来源:testing.py

示例4: test_paint_tool

def test_paint_tool():
    img = data.moon()
    viewer = ImageViewer(img)

    tool = PaintTool(viewer.ax, img.shape)

    tool.radius = 10
    assert_equal(tool.radius, 10)
    tool.label = 2
    assert_equal(tool.label, 2)
    assert_equal(tool.shape, img.shape)

    start = create_mouse_event(viewer.ax, xdata=100, ydata=100)
    tool.on_mouse_press(start)
    move = create_mouse_event(viewer.ax, xdata=110, ydata=110)
    tool.on_move(move)
    tool.on_mouse_release(move)
    assert_equal(tool.overlay[tool.overlay == 2].size, 761)

    tool.label = 5
    start = create_mouse_event(viewer.ax, xdata=20, ydata=20)
    tool.on_mouse_press(start)
    move = create_mouse_event(viewer.ax, xdata=40, ydata=40)
    tool.on_move(move)
    tool.on_mouse_release(move)
    assert_equal(tool.overlay[tool.overlay == 5].size, 881)
    assert_equal(tool.overlay[tool.overlay == 2].size, 761)

    enter = create_mouse_event(viewer.ax, key='enter')
    tool.on_mouse_press(enter)

    tool.overlay = tool.overlay * 0
    assert_equal(tool.overlay.sum(), 0)
开发者ID:SiggyF,项目名称:scikit-image,代码行数:33,代码来源:test_tools.py

示例5: main

def main():
    """Load image, apply filters and plot the results."""
    img = data.moon()
    util.plot_images_grayscale(
        [img, median(img), morphological_edge(img),
         erosion(img), dilation(img),
         opening(img), closing(img)],
        ["Image", "Median", "Morphological Edge", "Erosion", "Dilation", "Opening", "Closing"]
    )
开发者ID:aleju,项目名称:computer-vision-algorithms,代码行数:9,代码来源:rank_order.py

示例6: test_isodata_moon_image_negative_float

def test_isodata_moon_image_negative_float():
    moon = skimage.img_as_ubyte(data.moon()).astype(np.float64)
    moon -= 100

    assert -14 < threshold_isodata(moon) < -13

    thresholds = threshold_isodata(moon, return_all=True)
    assert_almost_equal(thresholds,
                        [-13.83789062, -12.84179688, -11.84570312, 22.02148438,
                         23.01757812, 24.01367188, 38.95507812, 39.95117188])
开发者ID:Gildus,项目名称:scikit-image,代码行数:10,代码来源:test_thresholding.py

示例7: test_isodata_moon_image

def test_isodata_moon_image():
    moon = skimage.img_as_ubyte(data.moon())

    threshold = threshold_isodata(moon)
    assert np.floor((moon[moon <= threshold].mean() + moon[moon > threshold].mean()) / 2.0) == threshold
    assert threshold == 86

    thresholds = threshold_isodata(moon, return_all=True)
    for threshold in thresholds:
        assert np.floor((moon[moon <= threshold].mean() + moon[moon > threshold].mean()) / 2.0) == threshold
    assert_equal(thresholds, [86, 87, 88, 122, 123, 124, 139, 140])
开发者ID:Britefury,项目名称:scikit-image,代码行数:11,代码来源:test_thresholding.py

示例8: test_isodata_moon_image_negative_int

def test_isodata_moon_image_negative_int():
    moon = skimage.img_as_ubyte(data.moon()).astype(np.int32)
    moon -= 100

    threshold = threshold_isodata(moon)
    assert np.floor((moon[moon <= threshold].mean() + moon[moon > threshold].mean()) / 2.0) == threshold
    assert threshold == -14

    thresholds = threshold_isodata(moon, return_all=True)
    for threshold in thresholds:
        assert np.floor((moon[moon <= threshold].mean() + moon[moon > threshold].mean()) / 2.0) == threshold
    assert_equal(thresholds, [-14, -13, -12, 22, 23, 24, 39, 40])
开发者ID:Britefury,项目名称:scikit-image,代码行数:12,代码来源:test_thresholding.py

示例9: test_adapthist_scalar

def test_adapthist_scalar():
    """Test a scalar uint8 image
    """
    img = skimage.img_as_ubyte(data.moon())
    adapted = exposure.equalize_adapthist(img, kernel_size=64, clip_limit=0.02)
    assert adapted.min() == 0.0
    assert adapted.max() == 1.0
    assert img.shape == adapted.shape
    full_scale = skimage.exposure.rescale_intensity(skimage.img_as_float(img))

    assert_almost_equal(peak_snr(full_scale, adapted), 102.066, 3)
    assert_almost_equal(norm_brightness_err(full_scale, adapted),
                        0.038, 3)
开发者ID:ameya005,项目名称:scikit-image,代码行数:13,代码来源:test_exposure.py

示例10: test_adapthist_scalar

def test_adapthist_scalar():
    '''Test a scalar uint8 image
    '''
    img = skimage.img_as_ubyte(data.moon())
    adapted = exposure.equalize_adapthist(img, clip_limit=0.02)
    assert adapted.min() == 0
    assert adapted.max() == (1 << 16) - 1
    assert img.shape == adapted.shape
    full_scale = skimage.exposure.rescale_intensity(skimage.img_as_uint(img))
    assert_almost_equal = np.testing.assert_almost_equal
    assert_almost_equal(peak_snr(full_scale, adapted), 101.231, 3)
    assert_almost_equal(norm_brightness_err(full_scale, adapted),
                        0.041, 3)
    return img, adapted
开发者ID:sergeyk,项目名称:scikits-image,代码行数:14,代码来源:test_exposure.py

示例11: test_base_tool

def test_base_tool():
    img = data.moon()
    viewer = ImageViewer(img)

    tool = CanvasToolBase(viewer)
    tool.set_visible(False)
    tool.set_visible(True)

    do_event(viewer, 'key_press', key='enter')

    tool.redraw()
    tool.remove()

    tool = CanvasToolBase(viewer, useblit=False)
    tool.redraw()
开发者ID:jarrodmillman,项目名称:scikit-image,代码行数:15,代码来源:test_tools.py

示例12: test_label_painter

def test_label_painter():
    image = data.camera()
    moon = data.moon()
    viewer = ImageViewer(image)
    lp = LabelPainter()
    viewer += lp

    assert_equal(lp.radius, 5)
    lp.label = 1
    assert_equal(str(lp.label), '1')
    lp.label = 2
    assert_equal(str(lp.paint_tool.label), '2')
    assert_equal(lp.paint_tool.radius, 5)
    lp._on_new_image(moon)
    assert_equal(lp.paint_tool.shape, moon.shape)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:15,代码来源:test_plugins.py

示例13: test_base_tool

def test_base_tool():
    img = data.moon()
    viewer = ImageViewer(img)

    tool = CanvasToolBase(viewer.ax)
    tool.set_visible(False)
    tool.set_visible(True)

    enter = create_mouse_event(viewer.ax, key='enter')
    tool._on_key_press(enter)

    tool.redraw()
    tool.remove()

    tool = CanvasToolBase(viewer.ax, useblit=False)
    tool.redraw()
开发者ID:SiggyF,项目名称:scikit-image,代码行数:16,代码来源:test_tools.py

示例14: test_keypoints_censure_moon_image_octagon

def test_keypoints_censure_moon_image_octagon():
    """Verify the actual Censure keypoints and their corresponding scale with
    the expected values for Octagon filter."""
    img = moon()
    actual_kp_octagon, actual_scale = keypoints_censure(img, 1, 7, 'Octagon',
                                                        0.15)
    expected_kp_octagon = np.array([[ 21, 496],
                                    [ 35,  46],
                                    [287, 250],
                                    [356, 239],
                                    [463, 116]])

    expected_scale = np.array([3, 4, 2, 2, 2])

    assert_array_equal(expected_kp_octagon, actual_kp_octagon)
    assert_array_equal(expected_scale, actual_scale)
开发者ID:Autodidact24,项目名称:scikit-image,代码行数:16,代码来源:_test_censure.py

示例15: test_keypoints_censure_moon_image_dob

def test_keypoints_censure_moon_image_dob():
    """Verify the actual Censure keypoints and their corresponding scale with
    the expected values for DoB filter."""
    img = moon()
    actual_kp_dob, actual_scale = keypoints_censure(img, 1, 7, 'DoB', 0.15)
    expected_kp_dob = np.array([[ 21, 497],
                                [ 36,  46],
                                [119, 350],
                                [185, 177],
                                [287, 250],
                                [357, 239],
                                [463, 116],
                                [464, 132],
                                [467, 260]])
    expected_scale = np.array([3, 4, 4, 2, 2, 3, 2, 2, 2])

    assert_array_equal(expected_kp_dob, actual_kp_dob)
    assert_array_equal(expected_scale, actual_scale)
开发者ID:Autodidact24,项目名称:scikit-image,代码行数:18,代码来源:_test_censure.py


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