First time here? Check out the FAQ!
answered 2020-05-28 03:47:25 -0600
Change this:
VideoCapture cap;
to:
VideoCapture cap(0);
Also this too:
if (!cap.open(0)) return 0;
if (!cap.open(0)) return -1;