# How to get X, Y of the face with open cv?

**URL:** <https://discourse.processing.org/t/how-to-get-x-y-of-the-face-with-open-cv/27183>\
**Category:** Libraries\
**Created:** [January 19, 2021, 12:44am UTC](https://discourse.processing.org/t/how-to-get-x-y-of-the-face-with-open-cv/27183 "2021-01-19T00:44:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LoneFalconer](https://avatars.discourse-cdn.com/v4/letter/l/ba9def/32.png) [@LoneFalconer](https://discourse.processing.org/u/LoneFalconer)\
**Post date:** [January 19, 2021, 12:44am UTC](https://discourse.processing.org/t/how-to-get-x-y-of-the-face-with-open-cv/27183/1 "2021-01-19T00:44:54Z")

</div>

> Hello,  
> I am pretty new to programming in java and am looking for a way to get the x and y chords of a face detected with OpenCV. I then want to use these chords in another function. Is there documentation on the OpenCV for processing? Thank you for your time!

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [January 19, 2021, 8:19am UTC](https://discourse.processing.org/t/how-to-get-x-y-of-the-face-with-open-cv/27183/2 "2021-01-19T08:19:26Z")

</div>

Hi,

Welcome to the community! 😉

Here is the GitHub [repo](https://github.com/atduskgreg/opencv-processing) for OpenCV for Processing and this is what you need :

> <https://github.com/atduskgreg/opencv-processing/blob/master/examples/FaceDetection/FaceDetection.pde>

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [January 19, 2021, 11:38am UTC](https://discourse.processing.org/t/how-to-get-x-y-of-the-face-with-open-cv/27183/3 "2021-01-19T11:38:14Z")

</div>

> [@LoneFalconer](#):
>
> for a way to get the x and y chords of a face detected with OpenCV

I’m not sure what you mean by chords, but since you used the beginner’s tag maybe you only need to study the example file of the FaceDetection example file of the OpenCV for Processing library, where you can see that x and y are obtained in the faces array. (faces[i].x, faces[i].y).  
However, if you mean by chords the individual facial features (mouth eyes etc.) this library can’t do that. But I’ve explained [in this link](https://discourse.processing.org/t/opencv-update-heaviside-step-function-deriving-parametric-functions-of-shapes-sobel-filter/21931/50), how Processing can use the latest OpenCV library. Then you need to study the [Haar Cascade Classifiers in OpenCV](https://medium.com/swlh/haar-cascade-classifiers-in-opencv-explained-visually-f608086fc42c) and use them as explained in [this tutorial.](https://fivedots.coe.psu.ac.th/~ad/jg/nui086/index.html)

---

<div class="post-metadata">

**Author:** ![LoneFalconer](https://avatars.discourse-cdn.com/v4/letter/l/ba9def/32.png) [@LoneFalconer](https://discourse.processing.org/u/LoneFalconer)\
**Post date:** [January 19, 2021, 4:48pm UTC](https://discourse.processing.org/t/how-to-get-x-y-of-the-face-with-open-cv/27183/4 "2021-01-19T16:48:52Z")

</div>

Thank you, sorry, I thought it as much and was trying to test it but when I was I used  
println(faces[i].x, faces[i].y);  
and it didn’t work. But now it is, thank you.
