91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 200KB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-23
  • 語言: Python
  • 標簽: 單目測距??

資源簡介

python程序,在opencv下使用單目攝像頭,測量人到攝像頭的距離,行人檢測。

資源截圖

代碼片段和文件信息

#!usr/bin/python
#?-*-?coding:?utf-8?-*-

#?import?the?necessary?packages
from?__future__?import?print_function
from?imutils.object_detection?import?non_max_suppression
from?imutils?import?paths
import?numpy?as?np
import?argparse
import?imutils
import?cv2


cap?=?cv2.VideoCapture(0)

#?initialize?the?HOG?descriptor/person?detector
hog?=?cv2.HOGDescriptor()
# 使用opencv默認的SVM分類器
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())

while(1):
????#?get?a?frame
????ret?frame?=?cap.read()
????
????frame?=?imutils.resize(frame?width=min(400?frame.shape[1]))


????#?detect?people?in?the?image
????(rects?weights)?=?hog.detectMultiScale(frame?winStride=(4?4)
?????????padding=(8?8)?scale=1.05)
????
????rects?=?np.array([[x?y?x?+?w?y?+?h]?for?(x?y?w?h)?in?rects])
????# 非極大抑制?消除多余的框?找到最佳人體
????pick?=?non_max_suppression(rects?probs=None?overlapThresh=0.65)

   ?#?畫出邊框
????for?(xA?yA?xB?yB)?in?pick:
???? cv2.rectangle(frame?(xA?yA)?(xB?yB)?(0?255?0)?2)

????#?show?a?frame
????cv2.imshow(“capture“?frame)
????if?cv2.waitKey(1)?&?0xFF?==?ord(‘q‘):
????????break
cap.release()
cv2.destroyAllWindows()?

評論

共有 條評論

相關資源