如何使用opencv分隔墙壁,天花板和地板

时间:2019-09-14 05:57:36

标签: python-3.x opencv

我正在尝试将虚拟绘画的墙壁,天花板和地板的一部分分开。

我尝试使用Canny检测墙壁边缘。如何分割检测到的轮廓

gary = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
canny = cv2.Canny(gary,thresh,thresh*2)

_,threshold =cv2.threshold(canny,127,200,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
temp =img.copy()

canny = cv2.Canny(gary,thresh,thresh*2)
# cv2.imshow("CAnny ",canny)
# cv2.imshow("Thresh ",threshold)


contours, hierarchy = cv2.findContours( canny, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
# print(contours)
cv2.drawContours(temp, contours, -1, (0,0,255), 1)

contour drawing after canny edge detection

0 个答案:

没有答案