简体   繁体   English

dlib,python:如何获得整个头部(不仅是脸部)的正方形(不是矩形)?

[英]dlib, python: how to get square (not a rectangle) with the whole head (not only face)?

dlib.get_frontal_face_detector() returns rectangles with detected faces on photo. dlib.get_frontal_face_detector()返回带有在照片上检测到的面孔的矩形。

And I need to get a square that covers not only face but the whole head. 我需要得到一个不仅覆盖脸部而且覆盖整个头部的正方形。

Is there an easy way to do this? 是否有捷径可寻?

There are 2 ways for this 1, Train your own modal and use that 2, Expand detected rectangle with some static value in % so that it covers whole head. 有1种方法,有1种,可以训练自己的模态并使用2种,用%的静态值扩展检测到的矩形,使其覆盖整个头部。

For example, Green is detected part and white is expanded (Photo courtesy: Google) 例如,检测到绿色,白色扩展了(照片由Google提供)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM