如何计算每个轮廓中的白色像素
我有一种算法来计算视频中的人数。这是一个概念:
背景减法>阈值> Canny> FindContour>总结每个轮廓中的白色像素,然后将它们变为数组列表。
所以,我希望输出变为eskexpLearRay = [总和右框中的像素的数量,总和左框中的像素的数量]
完成此操作
line=[]
for area in cv2.contourArea(cnt):
count=np.sum(box == 255)
line.append(count)
我想我可以使用此代码来 当然,代码是错误,说只能在Interger中迭代而不是浮动。除此之外,我还不确定我的代码。
I have an algorithm to count the number of people in video. Here is the concept:
background subtraction > Thresholding > canny > findcontour > sum the white pixel in each contour and make them to array list.
So, I want the output becomes examplearray = [sum the number of pixel in right box, sum the number of pixel in left box]
I think I can do it with this code
line=[]
for area in cv2.contourArea(cnt):
count=np.sum(box == 255)
line.append(count)
but I'am not sure, the code is error saying can only iterate in interger not float. Other than that, I'am not sure about my code yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论