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

Python draw.ellipse_perimeter函数代码示例

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

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



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

示例1: test_ellipse_perimeter_shape

def test_ellipse_perimeter_shape():
    img = np.zeros((15, 20), 'uint8')
    rr, cc = ellipse_perimeter(7, 10, 9, 9, 0, shape=(15, 20))
    img[rr, cc] = 1
    shift = 5
    img_ = np.zeros((15 + 2 * shift, 20), 'uint8')
    rr, cc = ellipse_perimeter(7 + shift, 10, 9, 9, 0, shape=None)
    img_[rr, cc] = 1
    assert_array_equal(img, img_[shift:-shift, :])
开发者ID:AlexG31,项目名称:scikit-image,代码行数:9,代码来源:test_draw.py


示例2: test_ellipse_perimeter_dot_nzeroangle

def test_ellipse_perimeter_dot_nzeroangle():
    # dot, angle != 0
    img = np.zeros((30, 15), 'uint8')
    rr, cc = ellipse_perimeter(15, 7, 0, 0, 1)
    img[rr, cc] = 1
    assert(np.sum(img) == 1)
    assert(img[15][7] == 1)
开发者ID:AlexG31,项目名称:scikit-image,代码行数:7,代码来源:test_draw.py


示例3: animate

    def animate(i):
        plt.title('Frame %d' % i)

        slice_data = preprocess_data(data[i + 100])

        if np.count_nonzero(slice_data):
            labeled_data, num_features = segment_data(slice_data)

            stats = slice_stats(labeled_data)
            stats = stats[(stats.area > 20) & ((stats.major_axis_length < frame_shape[0]) | (stats.major_axis_length < frame_shape[1]))]
            stats = stats[stats.circularity > 0.5]

            for index, row in stats.iterrows():
                print 'Frame# %d, Circle# %d [circularity = %f]' % (i, row.label, row.circularity)

                yc, xc = [int(round(x)) for x in row.centroid]
                orientation = row.orientation
                major_axis = int(round(row.major_axis_length/2.))
                minor_axis = int(round(row.minor_axis_length/2.))

                slice_data = ski.color.gray2rgb(slice_data)

                cy, cx = ellipse_perimeter(yc, xc, minor_axis, major_axis, orientation)
                slice_data[cy, cx] = (220, 20, 20)

                rr, cc = circle(yc, xc, 2)
                slice_data[rr, cc] = (220, 20, 20)

        im.set_data(slice_data)

        return im,
开发者ID:rshkarin,项目名称:guts-tracking,代码行数:31,代码来源:main.py


示例4: test_ellipse_perimeter_dot_zeroangle

def test_ellipse_perimeter_dot_zeroangle():
    # dot, angle == 0
    img = np.zeros((30, 15), "uint8")
    rr, cc = ellipse_perimeter(15, 7, 0, 0, 0)
    img[rr, cc] = 1
    assert np.sum(img) == 1
    assert img[15][7] == 1
开发者ID:RiggsOwen,项目名称:scikit-image,代码行数:7,代码来源:test_draw.py


示例5: test_hough_ellipse_non_zero_negangle4

def test_hough_ellipse_non_zero_negangle4():
    # ry < rx, angle in [-pi:-3pi/4]
    img = np.zeros((30, 24), dtype=int)
    rx = 12
    ry = 6
    x0 = 10
    y0 = 15
    angle = -np.pi / 1.35 - np.pi
    rr, cc = ellipse_perimeter(y0, x0, ry, rx, orientation=angle)
    img[rr, cc] = 1
    result = tf.hough_ellipse(img, threshold=15, accuracy=3)
    result.sort(order="accumulator")
    best = result[-1]
    # Check if I re-draw the ellipse, points are the same!
    # ie check API compatibility between hough_ellipse and ellipse_perimeter
    rr2, cc2 = ellipse_perimeter(y0, x0, int(best[3]), int(best[4]), orientation=best[5])
    assert_equal(rr, rr2)
    assert_equal(cc, cc2)
开发者ID:jjhelmus,项目名称:scikit-image,代码行数:18,代码来源:test_hough_transform.py


示例6: test_ellipse_perimeter_flat_zeroangle

def test_ellipse_perimeter_flat_zeroangle():
    # flat ellipse
    img = np.zeros((20, 18), 'uint8')
    img_ = np.zeros((20, 18), 'uint8')
    rr, cc = ellipse_perimeter(6, 7, 0, 5, 0)
    img[rr, cc] = 1
    rr, cc = line(6, 2, 6, 12)
    img_[rr, cc] = 1
    assert_array_equal(img, img_)
开发者ID:AlexG31,项目名称:scikit-image,代码行数:9,代码来源:test_draw.py


示例7: test_ellipse_perimeter

def test_ellipse_perimeter():
    img = np.zeros((30, 15), 'uint8')
    rr, cc = ellipse_perimeter(15, 7, 0, 0)
    img[rr, cc] = 1
    assert(np.sum(img) == 1)
    assert(img[15][7] == 1)

    img = np.zeros((30, 15), 'uint8')
    rr, cc = ellipse_perimeter(15, 7, 14, 6)
    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, 1, 1, 1, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
       [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0]]
    )

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


示例8: test_hough_ellipse_zero_angle

def test_hough_ellipse_zero_angle():
    img = np.zeros((25, 25), dtype=int)
    rx = 6
    ry = 8
    x0 = 12
    y0 = 15
    angle = 0
    rr, cc = ellipse_perimeter(y0, x0, ry, rx)
    img[rr, cc] = 1
    result = tf.hough_ellipse(img, threshold=9)
    best = result[-1]
    assert_equal(best[1], y0)
    assert_equal(best[2], x0)
    assert_almost_equal(best[3], ry, decimal=1)
    assert_almost_equal(best[4], rx, decimal=1)
    assert_equal(best[5], angle)
    # Check if I re-draw the ellipse, points are the same!
    # ie check API compatibility between hough_ellipse and ellipse_perimeter
    rr2, cc2 = ellipse_perimeter(y0, x0, int(best[3]), int(best[4]), orientation=best[5])
    assert_equal(rr, rr2)
    assert_equal(cc, cc2)
开发者ID:jjhelmus,项目名称:scikit-image,代码行数:21,代码来源:test_hough_transform.py


示例9: test_hough_ellipse_non_zero_posangle2

def test_hough_ellipse_non_zero_posangle2():
    # ry < rx, angle in [0:pi/2]
    img = np.zeros((30, 24), dtype=int)
    rx = 12
    ry = 6
    x0 = 10
    y0 = 15
    angle = np.pi / 1.35
    rr, cc = ellipse_perimeter(y0, x0, ry, rx, orientation=angle)
    img[rr, cc] = 1
    result = tf.hough_ellipse(img, threshold=15, accuracy=3)
    result.sort(order="accumulator")
    best = result[-1]
    assert_almost_equal(best[1] / 100.0, y0 / 100.0, decimal=1)
    assert_almost_equal(best[2] / 100.0, x0 / 100.0, decimal=1)
    assert_almost_equal(best[3] / 10.0, ry / 10.0, decimal=1)
    assert_almost_equal(best[4] / 100.0, rx / 100.0, decimal=1)
    assert_almost_equal(best[5], angle, decimal=1)
    # Check if I re-draw the ellipse, points are the same!
    # ie check API compatibility between hough_ellipse and ellipse_perimeter
    rr2, cc2 = ellipse_perimeter(y0, x0, int(best[3]), int(best[4]), orientation=best[5])
    assert_equal(rr, rr2)
    assert_equal(cc, cc2)
开发者ID:jjhelmus,项目名称:scikit-image,代码行数:23,代码来源:test_hough_transform.py


示例10: detect

def detect(d, i,**kwargs):
    image = d.read(d.images[i])
    global rgb
    rgb = d.read(d.images[i], flatten=False)
    pupil = find_pupil(image)[0]
    img, points, ellipse = find_iris(image, pupil, **kwargs)
    x, y = circle_perimeter(pupil[0], pupil[1], pupil[2])
    rgb[x,y] = (220, 40, 40)
    ex, ey = ellipse.center
    major, minor = ellipse.axes
    orientation = ellipse.orientation
    x, y = ellipse_perimeter(int(ex), int(ey), int(major), int(minor), orientation)
    rgb[x,y] = (220, 40, 40)
    imshow(rgb)
开发者ID:DuongHoangThuy,项目名称:iris-recognition-1,代码行数:14,代码来源:iris.py


示例11: test_hough_ellipse_non_zero_angle

def test_hough_ellipse_non_zero_angle():
    img = np.zeros((20, 20), dtype=int)
    a = 6
    b = 9
    x0 = 10
    y0 = 10
    angle = np.pi / 1.35
    rr, cc = ellipse_perimeter(x0, x0, b, a, orientation=angle)
    img[rr, cc] = 1
    result = tf.hough_ellipse(img, threshold=15, accuracy=3)
    assert_almost_equal(result[0][0] / 100., x0 / 100., decimal=1)
    assert_almost_equal(result[0][1] / 100., y0 / 100., decimal=1)
    assert_almost_equal(result[0][2] / 100., b / 100., decimal=1)
    assert_almost_equal(result[0][3] / 100., a / 100., decimal=1)
    assert_almost_equal(result[0][4], angle, decimal=1)
开发者ID:Autodidact24,项目名称:scikit-image,代码行数:15,代码来源:test_hough_transform.py


示例12: test_hough_ellipse_zero_angle

def test_hough_ellipse_zero_angle():
    img = np.zeros((25, 25), dtype=int)
    a = 6
    b = 8
    x0 = 12
    y0 = 12
    angle = 0
    rr, cc = ellipse_perimeter(x0, x0, b, a)
    img[rr, cc] = 1
    result = tf.hough_ellipse(img, threshold=9)
    assert_equal(result[0][0], x0)
    assert_equal(result[0][1], y0)
    assert_almost_equal(result[0][2], b, decimal=1)
    assert_almost_equal(result[0][3], a, decimal=1)
    assert_equal(result[0][4], angle)
开发者ID:Autodidact24,项目名称:scikit-image,代码行数:15,代码来源:test_hough_transform.py


示例13: draw_ellipses

def draw_ellipses(slice_data, ellipse, color=(220, 20, 20)):
    yc, xc = [int(round(x)) for x in ellipse.centroid]
    orientation = ellipse.orientation
    major_axis = int(round(ellipse.major_axis_length/2.))
    minor_axis = int(round(ellipse.minor_axis_length/2.))

    image = ski.color.gray2rgb(slice_data)

    cy, cx = ellipse_perimeter(yc, xc, minor_axis, major_axis, -orientation)
    image[cy, cx] = color

    rr, cc = circle(yc, xc, 2)
    image[rr, cc] = color

    return image
开发者ID:rshkarin,项目名称:guts-tracking,代码行数:15,代码来源:main.py


示例14: draw_ellipse

 def draw_ellipse(self, i=0):
     data = self._results_flat
     j = _np.argmax(data['count_density'][i])
     x, y = _skdraw.ellipse_perimeter(
         cy          = data['yc'][i][j].astype('int'),
         cx          = data['xc'][i][j].astype('int'),
         yradius     = data['a'][i][j].astype('int'),
         xradius     = data['b'][i][j].astype('int'),
         orientation = data['orientation'][i][j]
         )
     
     bounds_int = self._bounds[i].astype('int')
     
     bounds_int[x, y] = 2
 
     _ss.matplotlib.Imshow_Slider(bounds_int)
开发者ID:joelfrederico,项目名称:Blowout,代码行数:16,代码来源:ions.py


示例15: test_ellipse_perimeter_zeroangle

def test_ellipse_perimeter_zeroangle():
    # angle == 0
    img = np.zeros((30, 15), "uint8")
    rr, cc = ellipse_perimeter(15, 7, 14, 6, 0)
    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, 1, 1, 1, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
            [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
            [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
            [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
            [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0],
        ]
    )

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


示例16: main

def main():
    # Load picture, convert to grayscale and detect edges
    camera = cv2.VideoCapture(0)
    (ret, img) = camera.read()
    cv2.imshow("blah",img)
    gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
    cp = gray.copy()
    edges = cv2.Canny(gray,50,150,apertureSize = 3)
    print "hi"
    edges = img_as_float(edges)
    print "hi"

    # Perform a Hough Transform
    # The accuracy corresponds to the bin size of a major axis.
    # The value is chosen in order to get a single high accumulator.
    # The threshold eliminates low accumulators
    result = hough_ellipse(edges, accuracy=20, threshold=250, min_size=100, max_size=120)
    print "hi"
    result.sort(order='accumulator')
    print result

    # Estimated parameters for the ellipse
    if (len(result) > 0):
        print "apple"
        best = list(result[-1])
        yc, xc, a, b = [int(round(x)) for x in best[1:5]]
        orientation = best[5]

        # Draw the ellipse on the original image
        cy, cx = ellipse_perimeter(yc, xc, a, b, orientation)
        image_rgb[cy, cx] = (0, 0, 255)
        # Draw the edge (white) and the resulting ellipse (red)
        edges = color.gray2rgb(edges)
        edges[cy, cx] = (25, 0, 255)

    # fig2, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(8, 4), sharex=True,
    #                                 sharey=True,
    #                                 subplot_kw={'adjustable':'box-forced'})

    # ax1.set_title('Original picture')
    cv2.imshow("apple",img_as_ubyte(edges))
开发者ID:jburns20,项目名称:humanoids-project,代码行数:41,代码来源:tttt.py


示例17: redraw

 def redraw():
     global points
     global ellipse_params
     global in_image
     global plt
     global fig
     
     display_image = np.copy(in_image)
     
     from skimage.draw import line
     r_index, c_index = line(points[0][0], points[0][1], points[1][0], points[1][1])
     display_image[r_index, c_index] = np.array([200, 0, 0])
     
     if ellipse_params is not None:
         r_index, c_index = ellipse_perimeter(ellipse_params[0], ellipse_params[1],
                                              ellipse_params[2], ellipse_params[3],
                                              ellipse_params[4])
         display_image[r_index, c_index] = np.array([0, 0, 200])
     
     pltcop.set_data(display_image)
     fig.canvas.draw()
开发者ID:robeth,项目名称:multilayer-slic,代码行数:21,代码来源:__init__.py


示例18: test_detect_by_stats

def test_detect_by_stats():
    data = np.memmap("E:\\guts_tracking\\data\\fish202_aligned_masked_8bit_150x200x440.raw", dtype='uint8', shape=(440,200,150)).copy()

    data_slice = data[68]

    slice_data = preprocess_data(data_slice)
    labeled_data, num_features = segment_data(slice_data)

    #plt.imshow(labeled_data == 4, cmap='gray')
    #plt.show()

    stats = slice_stats(labeled_data)

    #stats = stats[(stats.area > 20) & (stats.area < np.pi * min(data_slice.shape)**2)]
    #stats = stats[(stats.area > 20) & (stats.area < 20000)]
    stats = stats[(stats.area > 2) & (stats.area < 20000)]
    #print stats
    #stats = stats[stats.circularity > 0.2]

    image = data_slice

    for index, row in stats.iterrows():
        print row
        yc, xc = [int(round(x)) for x in row.centroid]
        orientation = row.orientation
        major_axis = int(round(row.major_axis_length/2.))
        minor_axis = int(round(row.minor_axis_length/2.))

        image = ski.color.gray2rgb(image)

        cy, cx = ellipse_perimeter(yc, xc, minor_axis, major_axis, -orientation)
        image[cy, cx] = (220, 20, 20)

        rr, cc = circle(yc, xc, 2)
        image[rr, cc] = (220, 20, 20)

    plt.imshow(image, cmap='gray')
    plt.show()

    print stats
开发者ID:rshkarin,项目名称:guts-tracking,代码行数:40,代码来源:main.py


示例19: test_ellipse_perimeter_nzeroangle

def test_ellipse_perimeter_nzeroangle():
    # angle != 0
    img = np.zeros((30, 25), "uint8")
    rr, cc = ellipse_perimeter(15, 11, 12, 6, 1.1)
    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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
            [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
            [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
            [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 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:RiggsOwen,项目名称:scikit-image,代码行数:40,代码来源:test_draw.py


示例20: hough_ellipse

# Perform a Hough Transform
# The accuracy corresponds to the bin size of a major axis.
# The value is chosen in order to get a single high accumulator.
# The threshold eliminates low accumulators
accum = hough_ellipse(edges, accuracy=10, threshold=170, min_size=50)
accum.sort(key=lambda x:x[5])
# Estimated parameters for the ellipse
center_y = int(accum[-1][0])
center_x = int(accum[-1][1])
xradius = int(accum[-1][2])
yradius = int(accum[-1][3])
angle = np.pi - accum[-1][4]

# Draw the ellipse on the original image
cx, cy = ellipse_perimeter(center_y, center_x,
                           yradius, xradius, orientation=angle)
image_rgb[cy, cx] = (0, 0, 1)
# Draw the edge (white) and the resulting ellipse (red)
edges = color.gray2rgb(edges)
edges[cy, cx] = (250, 0, 0)

fig = plt.subplots(figsize=(10, 6))
plt.subplot(1, 2, 1)
plt.title('Original picture')
plt.imshow(image_rgb)
plt.subplot(1, 2, 2)
plt.title('Edge (white) and result (red)')
plt.imshow(edges)

plt.show()
开发者ID:Autodidact24,项目名称:scikit-image,代码行数:30,代码来源:plot_circular_elliptical_hough_transform.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python draw.ellipsoid函数代码示例发布时间:2022-05-27
下一篇:
Python draw.ellipse函数代码示例发布时间: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