bensherms
bensherms

Reputation: 83

unknown c++ object instantiation syntax

I'm in the process of looking over the OpenCV tutorial on Cascade Classifiers, and happened to see this syntax:

std::vector<Rect> faces;
Mat frame_gray;     
Mat faceROI = frame_gray( faces[i] );,

where there's some other code in between the frame_gray instantiation and the faceROI instantiation. My question is - what is the faceROI instantiation line doing/how does it work? It looks like a copy constructor usage, but the faces[i] parameter is confusing me.

http://docs.opencv.org/trunk/db/d28/tutorial_cascade_classifier.html - Tutorial http://docs.opencv.org/3.1.0/d3/d63/classcv_1_1Mat.html#af1d014cecd1510cdf580bf2ed7e5aafc - docs for Mat class

Upvotes: 0

Views: 40

Answers (1)

LoPiTaL
LoPiTaL

Reputation: 2595

That line is calling the

Mat operator()(const Rect &)

and not a copy constructor. This operator is used to call an object like a function.

You can find the information about this operator here: http://docs.opencv.org/3.1.0/d3/d63/classcv_1_1Mat.html#a07413f2e3e63a12185b8b218c24c7270

Upvotes: 5

Related Questions