为了账号安全,请及时绑定邮箱和手机立即绑定

在opencv-python中更改视频源时对图像的检测不佳

在opencv-python中更改视频源时对图像的检测不佳

慕尼黑的夜晚无繁华 2022-10-25 15:31:06
我制作了一个 Opencv 应用程序,用我的手机摄像头作为视频源来检测人脸,这在接收数据和显示视频方面非常有效,但问题在于图像检测,检测到的图像样本我确实使用了面部级联,但我的结果仍然很差这是我的代码import cv2import numpyurl = 'http://192.168.xxx.xx:8080/video'cap = cv2.VideoCapture(url)face = cv2.CascadeClassifier('cascade.xml')while(True):    ret, frame = cap.read()    if frame is not None:        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)        faces = face.detectMultiScale(gray, 1.1, 4)        for (x, y, w, h) in faces :            cv2.rectangle(frame,(x,y),(x+w, x+h),(255,0,0),2)        cv2.imshow('frame',frame)    q = cv2.waitKey(1)    if q == ord("q"):        breakcv2.destroyAllWindows()我的问题是..有什么方法可以让检测更准确??提前致谢
查看完整描述

1 回答

?
SMILET

TA贡献1796条经验 获得超4个赞

objects =   cv.CascadeClassifier.detectMultiScale(  image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]

Parameters

image   Matrix of the type CV_8U containing an image where objects are detected.

objects Vector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.

scaleFactor Parameter specifying how much the image size is reduced at each image scale.

minNeighbors    Parameter specifying how many neighbors each candidate rectangle should have to retain it.

flags   Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

minSize Minimum possible object size. Objects smaller than that are ignored.

maxSize Maximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

您可以使用 scaleFactor 和 minNeighbors。


查看完整回答
反对 回复 2022-10-25
  • 1 回答
  • 0 关注
  • 125 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信