■ 해리스 코너 검출기를 사용하는 방법을 보여준다.
▶ 예제 코드 (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 26 27 28 29 30 31 |
import matplotlib import matplotlib.pyplot as pp import skimage.color as color import skimage.data as data import skimage.feature as feature import skimage.io as io matplotlib.use("TkAgg") io.use_plugin("matplotlib") imageNDArray = io.imread("source.png") grayscaleImageNDArray = color.rgb2gray(imageNDArray) cornerNDArray = feature.corner_harris(grayscaleImageNDArray) coordNDArray = feature.corner_peaks(cornerNDArray, min_distance = 5) coordSubpixNDArray = feature.corner_subpix(grayscaleImageNDArray, coordNDArray, window_size = 13) figure, axesSubplot = pp.subplots() axesSubplot.imshow(grayscaleImageNDArray, interpolation = "nearest", cmap = pp.cm.gray) axesSubplot.plot(coordNDArray[:, 1], coordNDArray[:, 0], ".b", markersize = 3) axesSubplot.plot(coordSubpixNDArray[:, 1], coordSubpixNDArray[:, 0], "+r", markersize = 15) pp.show() |