Ask Your Question

Revision history [back]

A basic question on point classes and ellipses

I am attempting to teach myself some basic opencv concepts (c++ and Windows) by studying code examples. My goal is to develop a webcam based eye tracking app. I have found some good example code that I might be able to build upon, but I am first trying to learn what each part of the program does. However, I often have trouble finding a tutorial or explanation for something that seems very specific and basic.

Right now I am studying the cascade classifier tutorial:

http://docs.opencv.org/3.1.0/db/d28/tutorial_cascade_classifier.html#gsc.tab=0

I am confused about a couple of lines of code, which I believe has something to do with drawing an ellipse:

Point center( faces[i].x + faces[i].width/2, faces[i].y + faces[i].height/2 ); ellipse( frame, center, Size( faces[i].width/2, faces[i].height/2), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 );

I understand somewhat what the second line is about, but I can't make sense of the first. It has similarities to the code for the ellipse, but I believe it is a point class object. I read about the point class in the opencv documentation, but the code examples appeared quite different from the way in which it was used in the cascade classifier program. What exactly is being added?

Finally, is this the best place to ask some of these basic questions? I have many more, although I usually try to find answers myself first. But sometimes I can't seem to find exactly what I'm looking for.

click to hide/show revision 2
No.2 Revision

A basic question on point classes and ellipses

I am attempting to teach myself some basic opencv concepts (c++ and Windows) by studying code examples. My goal is to develop a webcam based eye tracking app. I have found some good example code that I might be able to build upon, but I am first trying to learn what each part of the program does. However, I often have trouble finding a tutorial or explanation for something that seems very specific and basic.

Right now I am studying the cascade classifier tutorial:

http://docs.opencv.org/3.1.0/db/d28/tutorial_cascade_classifier.html#gsc.tab=0

I am confused about a couple of lines of code, which I believe has something to do with drawing an ellipse:

 Point center( faces[i].x + faces[i].width/2, faces[i].y + faces[i].height/2 );
  ellipse( frame, center, Size( faces[i].width/2, faces[i].height/2), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 );

);

I understand somewhat what the second line is about, but I can't make sense of the first. It has similarities to the code for the ellipse, but I believe it is a point class object. I read about the point class in the opencv documentation, but the code examples appeared quite different from the way in which it was used in the cascade classifier program. What exactly is being added?

Finally, is this the best place to ask some of these basic questions? I have many more, although I usually try to find answers myself first. But sometimes I can't seem to find exactly what I'm looking for.