■ probabilistic_hough_line 함수에서 확률적 Hough 변환을 사용해 직선 정보를 구하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import matplotlib from skimage import color from skimage import feature from skimage import io from skimage import transform matplotlib.use("TkAgg") io.use_plugin("matplotlib") imageNDArray = io.imread("source.png") grayscaleImageNDArray = color.rgb2gray(imageNDArray) edgeImageNDArray = feature.canny(grayscaleImageNDArray, 2, 1, 25) lineList = transform.probabilistic_hough_line(edgeImageNDArray, threshold = 10, line_length = 5, line_gap = 3) print(type(lineList)) """ <class "list"> """ |