Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:40:05+00:00 2026-06-07T01:40:05+00:00

I have referred the documentation provided by OpenCV to make a face recognition program,

  • 0

I have referred the documentation provided by OpenCV to make a face recognition program, it recognizes multiple faces and is working normally. In the documentation they have made ellipses to highlight the face. What I don’t understand is how they have calculated the center of the ellipse which they have calculated as follows

for( int i = 0; i < faces.size(); i++ )
{
   Point center(faces[i].x+faces[i].width*0.5,faces[i].y+faces[i].height*0.5);
   //more code follows drawing the ellipse

The faces vector that they are using is produced as follows

face_cascade.detectMultiScale(frame_gray,faces,1.1,2,0|CV_HAAR_SCALE_IMAGE,cv::Size(30,30))

The documentation i.e. the program is given in the link

http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html

I want to know how they are calculating the center of the ellipse and if I want to draw a rectangle instead of a circle, what do I have to do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:40:07+00:00Added an answer on June 7, 2026 at 1:40 am

    Detected faces are returned as a set of rectangles surrounding the faces. As documentation says, output is Vector of rectangles where each rectangle contains the detected object.

    So one rectangle is comprised of [ initial x, initial y, width, height ]. So you can find its center by ( x + width*0.5 , y + height*0.5 ). This center is same for the ellipse also.

    If you want to draw rectangles, use rectangle function. See the Documentation.

    Arguments in the function will be as follows :

    pt1 = ( x , y )
    
    pt2 = ( x + width , y + height )
    

    Change the line drawing ellipse to following line :

    rectangle(frame,Point (faces[i].x,faces[i].y),Point (faces[i].x+faces[i].width, faces[i].y+faces[i].height),Scalar(255,0,255),4,8,0);
    

    It gives the result as follows :

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have referred this for creating error message tool tips, to be displayed continuously
I have developed a resizable panel in GWT. For this i have referred the
I have heard of types being referred to as boxed in some languages. In
I have been reading about Quicksort and found that sometimes it' s referred to
I am referred to Hudson today. I have heard about continuous integration before, but
Im newbie here.I have a problem with codeigniter segment() method.I referred 6th segment of
I have some code where, if a user has referred X number of people,
I have refereed old questions and found that people face many issues after installing
I am trying to create a new Schema in Oracle 11g. I have referred
I have a strange problem with object serialization. in the file documentation it states

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.