# About OpenCV Haar Cascades: Calculation and retrieval of x, y, w, h values for the bounding rectangle for face detection

**URL:** <https://forum.opencv.org/t/about-opencv-haar-cascades-calculation-and-retrieval-of-x-y-w-h-values-for-the-bounding-rectangle-for-face-detection/13818>\
**Category:** Python\
**Tags:** haar\
**Created:** [July 11, 2023, 6:35am UTC](https://forum.opencv.org/t/about-opencv-haar-cascades-calculation-and-retrieval-of-x-y-w-h-values-for-the-bounding-rectangle-for-face-detection/13818 "2023-07-11T06:35:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jayce](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jayce/32/8260_2.png) [@Jayce](https://forum.opencv.org/u/Jayce)\
**Post date:** [July 11, 2023, 6:35am UTC](https://forum.opencv.org/t/about-opencv-haar-cascades-calculation-and-retrieval-of-x-y-w-h-values-for-the-bounding-rectangle-for-face-detection/13818/1 "2023-07-11T06:35:32Z")

</div>

Good day!

Does anyone here know how to pinpoint the exact code for calculating the Haar Cascades’ x, y, w, h rectangle values in the OpenCV library? I would just like to review the library codes myself and know how these x, y, w, h variables are calculated, but I don’t know where to start.

I already checked the library codes (which is in [GitHub - opencv/opencv: Open Source Computer Vision Library](https://github.com/opencv/opencv)) but I am having a hard time finding the specific code/s.

Your answers are needed ASAP and appreciated greatly. Thanks!

---

<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:** [July 11, 2023, 7:50am UTC](https://forum.opencv.org/t/about-opencv-haar-cascades-calculation-and-retrieval-of-x-y-w-h-values-for-the-bounding-rectangle-for-face-detection/13818/2 "2023-07-11T07:50:15Z")

</div>

[code is here](https://github.com/opencv/opencv/tree/4.x/modules/objdetect/src), gl parsing it …

no, srsly, – read the [fine paper](https://www.cs.cmu.edu/~efros/courses/LBMV07/Papers/viola-cvpr-01.pdf), say something like: ah, integral images !

… and then move on, QUICKLY !  
ssd/yolo like cnns have superseded this technique,  
it may not even be partof the future opencv api …

---

<div class="post-metadata">

**Author:** ![Jayce](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jayce/32/8260_2.png) [@Jayce](https://forum.opencv.org/u/Jayce)\
**Post date:** [July 11, 2023, 8:05am UTC](https://forum.opencv.org/t/about-opencv-haar-cascades-calculation-and-retrieval-of-x-y-w-h-values-for-the-bounding-rectangle-for-face-detection/13818/3 "2023-07-11T08:05:00Z")

</div>

Noted. Your response is appreciated. Thanks!
