0

是否可以通过自适应阈值获得实体形状?在我的情况下(A)我只能得到空心形状,但似乎在某些情况下(B)有可能得到实心形状。(见下图) 在此处输入图像描述 输入要达到立体形状的要求是什么?

下面是我的代码 A

import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt

img_path = 'F:\\Coding Stuff\\Python\\Projects\\Open CV\\'
img = cv.imread(img_path + 'test_1.jpg')
img_gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
thresh = cv.adaptiveThreshold(img_gray, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11,2)
cv.imwrite('output.jpg', thresh)

这是输入图片
在此处输入图像描述

4

0 回答 0