LINUX.ORG.RU

Ошибка 'hough_ellipse' в OpenCV

 ,


0

1

Ошибка с hough_ellipse. Хочу найти круги с картинки (после использования черно белого контраста). Ищу способ чтобы находить елипсы с картинки. Но пока что ничего…. Заранее спасибо!

import cv2
import numpy as np
import skimage
import imutils
from imutils import contours
from skimage import measure
import argparse
from skimage.transform import hough_circle
from skimage.feature import canny
from skimage.draw import circle_perimeter
from skimage.util import img_as_ubyte

from skimage.transform import hough_circle, hough_circle_peaks

image = cv2.imread("2.jpg")

low = np.array([0,0,0])

up = np.array([350, 55, 100])

imgmask = cv2.inRange(image, low, up)
cv2.imshow("edweewe", imgmask)

edges = canny(imgmask, sigma=2.0, low_threshold=0.55, high_threshold=0.8)

result = hough_ellipse(edges, accuracy=20, threshold=250, min_size=100, max_size=120)


result.sort(order='accumulator')


best = list(result[-1])
yc, xc, a, b = [int(round(x)) for x in best[1:5]]
orientation = best[5]


cy, cx = ellipse_perimeter(yc, xc, a, b, orientation)
image_rgb[cy, cx] = (0, 0, 255)

edges = color.gray2rgb(img_as_ubyte(edges))
edges[cy, cx] = (250, 0, 0)

fig2, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(8, 4),
                                sharex=True, sharey=True)

ax1.set_title('Original picture')
ax1.imshow(image_rgb)

ax2.set_title('Edge (white) and result (red)')
ax2.imshow(edges)

plt.show()

result = hough_ellipse(edges, accuracy=20, threshold=250, min_size=100, max_size=120) NameError: name ‘hough_ellipse’ is not defined