Mr.Saeid Mr.Saeid - 1 month ago 7x
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.


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.