Python中文
首页
教程
问答
标签
搜索
登录
注册
drawCountour()不工作
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p><code>drawContour()</code>函数在视频帧中工作不正常。它使用这个<a href="https://stackoverflow.com/questions/31475634/drawcontours-not-working-opencv-python">stack-overflow answer</a>处理图像。输出的只是一幅不需要绘制任何轮廓的精明图像。你知道吗</p> <p>这是我的密码:</p> <pre><code>import cv2 import numpy as np cap = cv2.VideoCapture(0) while True: _, frame = cap.read() ret,thresh1 = cv2.threshold(frame,127,255,cv2.THRESH_BINARY) kernel = np.ones((5,5),np.uint8) erosion = cv2.erode(thresh1,kernel,iterations = 1) edges = cv2.Canny(erosion, 100 ,200) imCopy = edges.copy() laplacian = cv2.Laplacian(edges, cv2.CV_8UC1) sobely = cv2.Sobel(laplacian,cv2.CV_8UC1, 0, 1, ksize=5) im2, contours, hierarchy = cv2.findContours(sobely,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) frame = cv2.drawContours(im2, contours, -1, (255,0,0), 3) cv2.imshow('window',frame) print len(contours) k = cv2.waitKey(5) & 0xFF if k==27: break cv2.destroyAllWindows() cap.release() </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>使用</p> <pre><code>frame = cv2.drawContours(frame, contours, -1, (255,0,0), 3) cv2.imshow('window',frame) </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
为什么在使用strptime时会出现未进行转换的数据错误?
5 回答
为什么在使用strptim时会出现这个datetime日期错误
5 回答
为什么在使用StyleFrame时索引列的标题不显示sf.至excel()?
2 回答
为什么在使用sum()函数时会发生“int”对象不可调用的错误?
8 回答
为什么在使用sympy.dsolve时会得到“'list'对象没有属性'func'”?
3 回答
为什么在使用tabla时会得到一个空的数据帧?
8 回答
为什么在使用tensorboard时需要add_graph()的第二个参数?
3 回答
为什么在使用TensorFlow Lite转换YOLOv4时,推断时间/大小没有改进?有什么可能的改进吗?
7 回答
为什么在使用Tensorflow加载训练批时会出现内存泄漏?
5 回答
为什么在使用tensorflow时会收到警告/错误(使用函数API,但未实现错误)
7 回答
为什么在使用tetpyclient发出POST请求时出现403错误?
6 回答
为什么在使用TextBlob时会出现HTTP错误?
3 回答
为什么在使用TFIDF时出现错误“IndexError:list index out of range”pyspark.ml.feature?
3 回答
为什么在使用timedelta格式化之后,我在python中的日期是错误的?
2 回答
为什么在使用timeit或exec函数时,函数中的变量不会在提供的全局命名空间中搜索?
8 回答
为什么在使用tkinter时不能使用复选框?
4 回答
为什么在使用todoistpythonapi时会返回这个奇怪的ID?
8 回答
为什么在使用TQM时,在调整图像大小时,处理时间会有很大的差异?
7 回答
为什么在使用Tweepy下载用户时间线时收到错误消息
8 回答
为什么在使用twitter帐户登录Django应用程序时重定向127.0.0.1:8000?
10 回答