How can I check if multiple of the same object got detected?

asked 2018-05-25 08:44:14 -0500

KaanCidar gravatar image

updated 2018-12-10 09:26:32 -0500

hey i'm currently detecting faces with haar cascades but how can i tell if there are multiple number of that image?

faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x,y,w,h) in faces:
    cv.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
    roi_gray = gray[y:y+h, x:x+w]
    roi_color = img[y:y+h, x:x+w]
    eyes = eye_cascade.detectMultiScale(roi_gray)
    for (ex,ey,ew,eh) in eyes:
        cv.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)
cv.imshow('img',img)
cv.waitKey(0)
cv.destroyAllWindows()
edit retag flag offensive close merge delete

Comments

What do you mean by how can i tell if there are multiple number of that image? Are you trying to see if there are multiple faces detected?

eshirima gravatar imageeshirima ( 2018-05-25 08:58:36 -0500 )edit