# Face detection for static image, Find Top of head and chin

**URL:** <https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009>\
**Category:** C++\
**Created:** [April 27, 2021, 8:58am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009 "2021-04-27T08:58:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![miso](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/miso/32/1939_2.png) [@miso](https://forum.opencv.org/u/miso)\
**Post date:** [April 27, 2021, 8:58am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/1 "2021-04-27T08:58:50Z")

</div>

Hi everyone, I have studied OpenCV for couple of hours, but What I want to do is detect those two red line

1. top of head
2. chin

 ![Slice 2](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/5/5bcf07957c4ffad9ced1744a4d63d7161232ccd7.jpeg)

For now, I don’t need to find the point in real time, I can cost 2~3 second to calculate the two points( only needs Y-coordination )

So my need is pretty simple, But what I found on the internet is find the 2. chin only, but for the top of head… I haven’t found a good post yet.

What I have found is this post

> **[Hair segmentation – Vision & Graphics Group](https://vgg.fiit.stuba.sk/2013-04/hair-segmentation/)**

So somehow it can extract the hair, so I just get the topmost point of hair segmentation as top of head, then I can figure out these two point.

But I just wonder, does this simple request needed to be commit so much efforts? are there simple ways to do?  
And since hair is varied a lot, maybe the person is bald or with colorful hair, but usually is black, white or gray  
I need to consider all of these cases.

Thanks for review my question.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 27, 2021, 9:09am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/2 "2021-04-27T09:09:46Z")

</div>

> [@miso](#):
>
> I have studied OpenCV for couple of hours

welcome, expect some more 😉

> [@miso](#):
>
> But I just wonder, does this simple request needed to be commit so much efforts? are there simple ways to do?

i would not think you need something as complicated as hair detection.  
opencv comes with several face detection methods, like [cascades](https://docs.opencv.org/master/db/d28/tutorial_cascade_classifier.html) and [dnn based detection](https://github.com/opencv/opencv/blob/master/samples/dnn/js_face_recognition.html#L14), there are also [facial landmark detectors](https://docs.opencv.org/master/d5/d47/tutorial_table_of_content_facemark.html), which can give you the actual face outline.

---

<div class="post-metadata">

**Author:** ![miso](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/miso/32/1939_2.png) [@miso](https://forum.opencv.org/u/miso)\
**Post date:** [April 27, 2021, 10:09am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/3 "2021-04-27T10:09:57Z")

</div>

I check topmost results of google “facial landmark detectors” and “facial landmark detection”, but what I have seen, they don’t detect “top of head”(need to consider hair), they do detect chin, and face outline.

For example, I found this one post

> <https://stackoverflow.com/questions/44314178/face-and-hair-detection-for-python>

it says if you want detection area include hair, then you need to train your data, since current model not include that.

If there has something I have missed, please tell me.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 27, 2021, 10:15am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/4 "2021-04-27T10:15:19Z")

</div>

so, what have you _tried_, so far, on your own ?  
and what is the purpose of it all ?

again, you probably do not need to detect hairs

---

<div class="post-metadata">

**Author:** ![miso](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/miso/32/1939_2.png) [@miso](https://forum.opencv.org/u/miso)\
**Post date:** [May 4, 2021, 8:29am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/5 "2021-05-04T08:29:07Z")

</div>

I have followed this example and test it on my image.

> **[Dlib 68 points Face landmark Detection with OpenCV and Python - Studytonight](https://www.studytonight.com/post/dlib-68-points-face-landmark-detection-with-opencv-and-python)**

But still try to find how to draw the line of top of head (red line)

Now I know the lowest Y coordinate will be jaw position.

 ![current](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/3/33f2aff3473cb2c1d411d37b8fcc125f5ba5bd1e.jpeg)

Thanks for the keyword hint. Now I need to figure out how to find the point of top of head.

Do you know how to find that?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 4, 2021, 8:38am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/6 "2021-05-04T08:38:56Z")

</div>

![landmarks68](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/3/397eeb106b3e832f0104d1e8eb8c177985ad6eaf.jpeg)

(edit: better image)

---

<div class="post-metadata">

**Author:** ![miso](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/miso/32/1939_2.png) [@miso](https://forum.opencv.org/u/miso)\
**Post date:** [May 4, 2021, 10:32am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/7 "2021-05-04T10:32:29Z")

</div>

Got it. So the 8th point would be jaw point? How about the top of head… still don’t have any idea about that.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 4, 2021, 10:40am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/8 "2021-05-04T10:40:41Z")

</div>

can you tell us, what you’re trying to do with it ? what’s the purpose of your program ?

finding the top of the head is highly unreliable  
(hair gets in the way again, which is probably meaningless for “measurement”)

---

<div class="post-metadata">

**Author:** ![miso](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/miso/32/1939_2.png) [@miso](https://forum.opencv.org/u/miso)\
**Post date:** [May 7, 2021, 3:27am UTC](https://forum.opencv.org/t/face-detection-for-static-image-find-top-of-head-and-chin/3009/9 "2021-05-07T03:27:32Z")

</div>

We need to extract head for printing photo, let’s what we want to do.  
But I found a way to solve that using Canny to detect edge will probably solve my problem
