这是我的图像:
python - python(opencv)中的图像分割-昆虫翅膀-LMLPHP

另一个例子:
python - python(opencv)中的图像分割-昆虫翅膀-LMLPHP

现在地面真理:
python - python(opencv)中的图像分割-昆虫翅膀-LMLPHP
python - python(opencv)中的图像分割-昆虫翅膀-LMLPHP

我需要一个代码来获得类似于地面真理算法的结果,任何想法和建议都会对我有所帮助,因为我什至不知道从哪里开始,谢谢。

最佳答案

import cv2 as cv
from matplotlib import pyplot as plt

# Load image in grayscale
img = cv.imread('coins.png',0)

# threshold the image
thresh = cv.threshold(img,0,255,cv.THRESH_BINARY_INV+cv.THRESH_OTSU)[1]

# display the image
plt.imshow(thresh, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([])  # to hide tick values on X and Y axis
plt.show()

引用此example

关于python - python(opencv)中的图像分割-昆虫翅膀,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57830319/

10-13 04:35