4
我是一个新手在python和opencv,我想创建一个轨道栏来控制函数层次结构cv2.findContours 但我不知道如何将它添加到源代码 她是代码:cv2.createTrackbar使用python
import cv2
import cv2.cv as cv
cv2.namedWindow("test")
vc = cv2.VideoCapture(2);
retVal, frame = vc.read();
while True:
if frame is not None:
imgray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(imgray,127,255,0)
contours, hierarchy = cv2.findContours(thresh,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(frame, contours, -1, (0,255,0), 2)
cv2.imshow("test", frame)
rval, frame = vc.read()
if cv2.waitKey(1) & 0xFF == 27:
break
cv.DestroyAllWindows()
预先感谢您