Соединение find_contours на краю изображенияPython

Программы на Python
Anonymous
Соединение find_contours на краю изображения

Сообщение Anonymous »

Пытаюсь использовать этот код:
https://scikit-image.org/docs/stable/au ... props.html
Проблема в том, что объект отваливается изображение, что не замыкает контур до ближайшего открытого контура. Есть идеи? Заранее спасибо.
import numpy as np
import matplotlib.pyplot as plt

from skimage import measure

# Construct some test data
r = masks[1]['segmentation']
# Find contours at a constant value of 0.8
contours = measure.find_contours(r, 0.8)

# Display the image and plot all contours found
fig, ax = plt.subplots()
ax.imshow(r, cmap=plt.cm.gray)

for contour in contours:
ax.plot(contour[:, 1], contour[:, 0], linewidth=2)

ax.axis('image')
ax.set_xticks([])
ax.set_yticks([])
plt.show()


Подробнее здесь: https://stackoverflow.com/questions/783 ... f-an-image

Вернуться в «Python»