!_src.empty() in function 'cv::cvtColor'

MRE required.

clearly the code throws some exception. did you notice?

you followed bad advice. your code lacks the MANDATORY error checking for the cap.read() call