Mr.Saeid Mr.Saeid -4 years ago 120
C++ Question

Meaning of " >> " operator?

i didn't understand meaning of >> operator in c++. for example in following code, what's mean

cap >> cam_frame;

cv::Mat cam_frame;
cv::VideoCapture cap;
DWORD WINAPI LiveViewTrd(void* p)
if (cap.isOpened())
cap >> cam_frame;
return 0;

thanks in advance.

Answer Source

Normally >> means bitwise right shift.

But C++ gives you the ability to overload operators. This is what is happening here: cv::VideoCapture has an overloaded >> operator which can take a cv::Mat as an argument.

Since this is a clear deviation from what >> does by default, you need to consult the class documentation for a description of what it actually does.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download