• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python draw.ellipse函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_ellipse_trivial

def test_ellipse_trivial():
    img = np.zeros((2, 2), "uint8")
    rr, cc = ellipse(0.5, 0.5, 0.5, 0.5)
    img[rr, cc] = 1
    img_correct = np.array([[0, 0], [0, 0]])
    assert_array_equal(img, img_correct)

    img = np.zeros((2, 2), "uint8")
    rr, cc = ellipse(0.5, 0.5, 1.1, 1.1)
    img[rr, cc] = 1
    img_correct = np.array([[1, 1], [1, 1]])
    assert_array_equal(img, img_correct)

    img = np.zeros((3, 3), "uint8")
    rr, cc = ellipse(1, 1, 0.9, 0.9)
    img[rr, cc] = 1
    img_correct = np.array([[0, 0, 0], [0, 1, 0], [0, 0, 0]])
    assert_array_equal(img, img_correct)

    img = np.zeros((3, 3), "uint8")
    rr, cc = ellipse(1, 1, 1.1, 1.1)
    img[rr, cc] = 1
    img_correct = np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
    assert_array_equal(img, img_correct)

    img = np.zeros((3, 3), "uint8")
    rr, cc = ellipse(1, 1, 1.5, 1.5)
    img[rr, cc] = 1
    img_correct = np.array([[1, 1, 1], [1, 1, 1], [1, 1, 1]])
    assert_array_equal(img, img_correct)
开发者ID:RiggsOwen,项目名称:scikit-image,代码行数:30,代码来源:test_draw.py


示例2: test_ellipse_rotation_symmetry

def test_ellipse_rotation_symmetry():
    img1 = np.zeros((150, 150), dtype=np.uint8)
    img2 = np.zeros((150, 150), dtype=np.uint8)
    for angle in range(0, 180, 15):
        img1.fill(0)
        rr, cc = ellipse(80, 70, 60, 40, rotation=np.deg2rad(angle))
        img1[rr, cc] = 1
        img2.fill(0)
        rr, cc = ellipse(80, 70, 60, 40, rotation=np.deg2rad(angle + 180))
        img2[rr, cc] = 1
        assert_array_equal(img1, img2)
开发者ID:ameya005,项目名称:scikit-image,代码行数:11,代码来源:test_draw.py


示例3: add_Ellipse

 def add_Ellipse(self, scale = 1, thick = 5):
     """h for vertical, w for horizontal"""
     h = self.e_h = self.base_e_h * scale
     w = self.e_w = self.base_e_w * scale
     
     # e and lv should not be too close
     shift = self.e_w/8
     center = self.lv_center + self.lv_radius_vec
     center[1] += shift
     
     self.e_center = center 
     self.e_thick = thick
     self.e_big  = d.ellipse(center[0], center[1], h, w)
     self.e_small= d.ellipse(center[0], center[1], h-thick, w-thick)
开发者ID:ZijiaLewisLu,项目名称:HeartDeep-Kaggle-DSB2,代码行数:14,代码来源:maker.py


示例4: test_ellipse

def test_ellipse():
    img = np.zeros((15, 15), 'uint8')

    rr, cc = ellipse(7, 7, 3, 7)
    img[rr, cc] = 1

    img_ = np.array(
      [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
       [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
    )

    assert_array_equal(img, img_)
开发者ID:ChrisBeaumont,项目名称:scikit-image,代码行数:25,代码来源:test_draw.py


示例5: test_ellipse_with_shape

def test_ellipse_with_shape():
    img = np.zeros((15, 15), 'uint8')

    rr, cc = ellipse(7, 7, 3, 10, shape=img.shape)
    img[rr, cc] = 1

    img_ = np.array(
      [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
    )

    assert_array_equal(img, img_)
开发者ID:AlexG31,项目名称:scikit-image,代码行数:25,代码来源:test_draw.py


示例6: makeFakeVessels

def makeFakeVessels(imgsize=(512, 512), background=230):
    """
    create and save a matrix with whitish background and randomly selected vessel sizes and save matrices generated as images of format png
    """
    nVes = 20
    mu = 20
    sigma = 5
    minw = 5
    sx, sy = imgsize
    vasc = np.ones((sx, sy), dtype=np.uint8) * background

    for i in range(nVes):
        cx, cy = random.uniform(0, sx), random.uniform(0, sy)
        r1, r2 = 0, 0
        while (r1 < minw) or (r2 < minw):
            np.random.seed(20)
            r1 = np.random.normal(mu, sigma)
            r2 = np.random.normal(mu, sigma)
        print(r1, r2)

        rr, cc = ellipse(cy, cx, r1, r2)
        if np.any(rr >= sy):
            ix = rr < sy
            rr, cc = rr[ix], cc[ix]
        if np.any(cc >= sx):
            ix = cc < sx
            rr, cc = rr[ix], cc[ix]
        vasc[rr, cc] = 1  # make circle blackish
    return vasc
开发者ID:3Scan,项目名称:3scan-skeleton,代码行数:29,代码来源:firstPhantom.py


示例7: test_ellipse_negative

def test_ellipse_negative():
    rr, cc = ellipse(-3, -3, 1.7, 1.7)
    rr_, cc_ = np.nonzero(
        np.array([[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]])
    )

    assert_array_equal(rr, rr_ - 5)
    assert_array_equal(cc, cc_ - 5)
开发者ID:RiggsOwen,项目名称:scikit-image,代码行数:8,代码来源:test_draw.py


示例8: setup

def setup():
    image = np.zeros((30, 30, 3), dtype=float)
    image[draw.ellipse(15, 15, 5, 8)] = 1

    state = np.zeros((30, 30, 2))
    state[15, 15] = (1, 1)
    state[0, 0] = (0, 1)

    return image, state
开发者ID:andandandand,项目名称:growcut_py,代码行数:9,代码来源:test_growcut_py.py


示例9: get_indices

 def get_indices(self):
     """Returns a set of points that lie inside the picked polygon."""
     if not self.center:
         raise ValueError("Cannot get ellipse indices before the dimensions are defined")
     
     x, y = self.center
     w = self.width
     h = self.height
     return ellipse(y, x, h/2., w/2., self.im)
开发者ID:JoshBradshaw,项目名称:bloodtools,代码行数:9,代码来源:ROI.py


示例10: test_ellipse_rotated

def test_ellipse_rotated():
    img = np.zeros((1000, 1200), dtype=np.uint8)
    for rot in range(0, 180, 10):
        img.fill(0)
        angle = np.deg2rad(rot)
        rr, cc = ellipse(500, 600, 200, 400, rotation=angle)
        img[rr, cc] = 1
        # estimate orientation of ellipse
        angle_estim = np.round(regionprops(img)[0].orientation, 3) % (np.pi / 2)
        assert_almost_equal(angle_estim, angle % (np.pi / 2), 2)
开发者ID:ameya005,项目名称:scikit-image,代码行数:10,代码来源:test_draw.py


示例11: test_rotate_largest_region

 def test_rotate_largest_region(self):
     test_img = np.zeros((1000,1000), dtype=np.uint8)
     rr, cc = circle(100,100,50)
     test_img[rr,cc] = 1
     rr, cc = ellipse(500,500,300,100)
     test_img[rr, cc] = 1
     rotated = gzapi.rotate_largest_region(test_img)
     largest_region = gzapi.get_largest_region(rotated)
     self.assertAlmostEqual(largest_region.orientation, 0)
     self.assertIsNone(gzapi.rotate_largest_region(None))
开发者ID:jaidevd,项目名称:galaxyzoo,代码行数:10,代码来源:test_api.py


示例12: sim_wire

def sim_wire(angle, gaussian_sigma=1, noise_level=0, L=100):
    "Draw a wire with blur and optional noise."
    # Noise level should be from 0 to 1. 0.02 is reasonable.
    shape = (L, L)

    a = np.zeros(shape, dtype=np.uint8)
    a[draw.ellipse(L//2, L//2, L//24, L//4)] = 100  # horizontal ellipse
    a = filter.gaussian_filter(a, gaussian_sigma)
    b = transform.rotate(a, angle)
    b += noise_level*np.random.randn(*shape)
    return b
开发者ID:danielballan,项目名称:needle,代码行数:11,代码来源:test_wire.py


示例13: _measure_fluorescence

 def _measure_fluorescence(self, time_period, time_index, image_slice, channel_annotation):
     mask = np.zeros((image_slice.height * 2, image_slice.width))
     old_pole, new_pole = channel_annotation.get_cell_bounds(time_period, time_index)
     ellipse_minor_radius = int(0.80 * image_slice.height)
     ellipse_major_radius = int((new_pole - old_pole) / 2.0) * 0.8
     centroid_y = int(image_slice.height)
     centroid_x = int((new_pole + old_pole) / 2.0)
     rr, cc = draw.ellipse(centroid_y, centroid_x, ellipse_minor_radius, ellipse_major_radius)
     mask[rr, cc] = 1
     mean, stddev, median, area, centroid = self._calculate_cell_intensity_statistics(mask.astype("int"), image_slice.image_data)
     return mean, stddev, median, area, centroid
开发者ID:finkelsteinlab,项目名称:fylm,代码行数:11,代码来源:fluorescence.py


示例14: test_growcut_basic

def test_growcut_basic():
    image = np.zeros((30, 30, 3), dtype=float)
    image[draw.ellipse(15, 15, 5, 8)] = 1

    state = np.zeros((30, 30, 2))
    state[15, 15] = (1, 1)
    state[0, 0] = (0, 1)

    npt.assert_array_equal(image[..., 0],
                           growcut(image, state, window_size=3, max_iter=20))

    npt.assert_array_equal(image[..., 0],
                           growcut_fast(image, state, window_size=3, max_iter=20))
开发者ID:ahmadia,项目名称:growcut_py,代码行数:13,代码来源:test_growcut_py.py


示例15: ellipse

def ellipse(width, height, dtype=np.uint8):
    """Generates a flat, ellipse-shaped structuring element.

    Every pixel along the perimeter of ellipse satisfies
    the equation ``(x/width+1)**2 + (y/height+1)**2 = 1``.

    Parameters
    ----------
    width : int
        The width of the ellipse-shaped structuring element.
    height : int
        The height of the ellipse-shaped structuring element.

    Other Parameters
    ----------------
    dtype : data-type
        The data type of the structuring element.

    Returns
    -------
    selem : ndarray
        The structuring element where elements of the neighborhood
        are 1 and 0 otherwise.

    Examples
    --------
    >>> from skimage.morphology import selem
    >>> selem.ellipse(5, 3)
    array([[0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
           [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
           [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
           [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
           [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
           [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
           [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0]], dtype=uint8)

    """
    selem = np.zeros((2 * height + 1, 2 * width + 1), dtype=dtype)
    rows, cols = draw.ellipse(height, width, height + 1, width + 1)
    selem[rows, cols] = 1
    return selem
开发者ID:haohao200609,项目名称:Hybrid,代码行数:41,代码来源:selem.py


示例16: ellipseMask

def ellipseMask(maskImg, ellipse_yradius, ellipse_xradius):
    boxsize = maskImg.get_xsize()
    maskArray = EMNumPy.em2numpy(maskImg)
    
    if (boxsize <= ellipse_yradius * 2 or boxsize <= ellipse_xradius * 2):
        print "ERROR: ellipse_xradius or ellipse_yradius is larger than the boxsize of particles."
        sys.exit()
    
    #from skimage.draw import ellipse
    #Generate coordinates of pixels within ellipse.
    ####################################
    '''
    ellipse_xradius=random.randint(ellipse_xradius-10,ellipse_xradius+10)
    print ellipse_xradius
    ellipse_yradius=random.randint(ellipse_yradius-10,ellipse_yradius+10)
    print ellipse_yradius
    '''
    size = max([ellipse_xradius, ellipse_yradius]) * 2 + 4
    cx = size/2
    cy = size/2
    ellipseArray = np.zeros((size, size), dtype=np.uint8)
    rr, cc = ellipse(cy, cx, ellipse_yradius, ellipse_xradius)
    ellipseArray[rr, cc] = 1
    
    m, n = ellipseArray.shape
    assert m==n
    
    if (m%2 == 0):
        pad_before = (boxsize - m)/2
        pad_after = (boxsize - m)/2
    else:
        pad_before = (boxsize - m)/2
        pad_after = (boxsize - m)/2+1
        
    ellipseArrayPad = np.pad(ellipseArray, (pad_before, pad_after), mode='constant')
    ellipseImg = EMNumPy.numpy2em(ellipseArrayPad)
    return ellipseImg
开发者ID:jianglab,项目名称:HybridNanoParticles,代码行数:37,代码来源:simGold.py


示例17: approximate_polygon

# approximate subdivided polygon with Douglas-Peucker algorithm
appr_hand = approximate_polygon(new_hand, tolerance=0.02)

print("Number of coordinates:", len(hand), len(new_hand), len(appr_hand))

fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(9, 4))

ax1.plot(hand[:, 0], hand[:, 1])
ax1.plot(new_hand[:, 0], new_hand[:, 1])
ax1.plot(appr_hand[:, 0], appr_hand[:, 1])


# create two ellipses in image
img = np.zeros((800, 800), 'int32')
rr, cc = ellipse(250, 250, 180, 230, img.shape)
img[rr, cc] = 1
rr, cc = ellipse(600, 600, 150, 90, img.shape)
img[rr, cc] = 1

plt.gray()
ax2.imshow(img)

# approximate / simplify coordinates of the two ellipses
for contour in find_contours(img, 0):
    coords = approximate_polygon(contour, tolerance=2.5)
    ax2.plot(coords[:, 1], coords[:, 0], '-r', linewidth=2)
    coords2 = approximate_polygon(contour, tolerance=39.5)
    ax2.plot(coords2[:, 1], coords2[:, 0], '-g', linewidth=2)
    print("Number of coordinates:", len(contour), len(coords), len(coords2))
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:29,代码来源:plot_polygon.py


示例18: test_ellipse_generic

def test_ellipse_generic():
    img = np.zeros((4, 4), 'uint8')
    rr, cc = ellipse(1.5, 1.5, 1.1, 1.7)
    img[rr, cc] = 1
    img_ = np.array([
        [0, 0, 0, 0],
        [1, 1, 1, 1],
        [1, 1, 1, 1],
        [0, 0, 0, 0],
    ])
    assert_array_equal(img, img_)

    img = np.zeros((5, 5), 'uint8')
    rr, cc = ellipse(2, 2, 1.7, 1.7)
    img[rr, cc] = 1
    img_ = np.array([
        [0, 0, 0, 0, 0],
        [0, 1, 1, 1, 0],
        [0, 1, 1, 1, 0],
        [0, 1, 1, 1, 0],
        [0, 0, 0, 0, 0],
    ])
    assert_array_equal(img, img_)

    img = np.zeros((10, 10), 'uint8')
    rr, cc = ellipse(5, 5, 3, 4)
    img[rr, cc] = 1
    img_ = np.array([
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ])
    assert_array_equal(img, img_)

    img = np.zeros((10, 10), 'uint8')
    rr, cc = ellipse(4.5, 5, 3.5, 4)
    img[rr, cc] = 1
    img_ = np.array([
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ])
    assert_array_equal(img, img_)

    img = np.zeros((15, 15), 'uint8')
    rr, cc = ellipse(7, 7, 3, 7)
    img[rr, cc] = 1
    img_ = np.array([
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
        [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ])
    assert_array_equal(img, img_)
开发者ID:AlexG31,项目名称:scikit-image,代码行数:79,代码来源:test_draw.py


示例19:

ax3.set_axis_off()
ax3.set_title('Masked pixels')


plt.show()

##################################################
# Solid masks are another illustrating example. In this case, we have a 
# limited view of an image and an offset image. The masks for these images 
# need not be the same. The `masked_register_translation` function will correctly identify
# which part of the images should be compared.
image = data.camera()
shift = (-22, 13)

rr1, cc1 = draw.ellipse(259, 248, 
                      r_radius = 125, c_radius = 100, 
                      shape = image.shape)

rr2, cc2 = draw.ellipse(300, 200, 
                        r_radius = 110, c_radius = 180, 
                        shape = image.shape)

mask1 = np.zeros_like(image, dtype = np.bool)
mask2 = np.zeros_like(image, dtype = np.bool)
mask1[rr1, cc1] = True
mask2[rr2, cc2] = True

offset_image = ndi.shift(image, shift)
image *= mask1
offset_image *= mask2
开发者ID:TheArindham,项目名称:scikit-image,代码行数:30,代码来源:plot_masked_register_translation.py


示例20: polygon

poly = np.array((
    (300, 300),
    (480, 320),
    (380, 430),
    (220, 590),
    (300, 300),
))
rr, cc = polygon(poly[:,0], poly[:,1], img.shape)
img[rr,cc,1] = 255

# fill circle
rr, cc = circle(200, 200, 100, img.shape)
img[rr,cc,:] = (255, 255, 0)

# fill ellipse
rr, cc = ellipse(300, 300, 100, 200, img.shape)
img[rr,cc,2] = 255

# circle
rr, cc = circle_perimeter(120, 400, 15)
img[rr, cc, :] = (255, 0, 0)

# ellipses
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=math.pi / 4.)
img[rr, cc, :] = (255, 0, 255)
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=-math.pi / 4.)
img[rr, cc, :] = (0, 0, 255)
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=math.pi / 2.)
img[rr, cc, :] = (255, 255, 255)

plt.imshow(img)
开发者ID:Greenwicher,项目名称:scikit-image,代码行数:31,代码来源:plot_shapes.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python draw.ellipse_perimeter函数代码示例发布时间:2022-05-27
下一篇:
Python draw.circle_perimeter函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap