Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace harcascade with DNN #6

Closed
Kingbadger3d opened this issue Mar 1, 2019 · 1 comment
Closed

Replace harcascade with DNN #6

Kingbadger3d opened this issue Mar 1, 2019 · 1 comment

Comments

@Kingbadger3d
Copy link

Hi again Serengil, Thanks for the help.

Im trying to replace the harcascade with the dnn module from opencv, Ive got the dnn working recogniseing the faces but the bounding box's return are rectangles, not box's.

The perfect ratio seems to be 1.35 * dnn_rect.width, here's the origninal code:

    # compute the (x, y)-coordinates of the bounding box for the
    # object
    box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
    (startX, startY, endX, endY) = box.astype("int")

    # draw the bounding box of the face along with the associated
    # probability
    text = "{:.2f}%".format(confidence * 100)
    y = startY - 10 if startY - 10 > 10 else startY + 10
    cv2.rectangle(frame, (startX, startY ), (endX, endY), (255, 255, 255), 1)
    cv2.putText(frame, text, (startX, y), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (255, 255, 255), 1)

How is best to change the above code to take the bounding rectangle width from the dnn and do the 1.35 * dnn_rect.width to still be able to run the face emotion detector code on the resulting cropped square.

Cheers J

@serengil
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants