OpenCV error: (-215:Assertion failed) !_src.empty() in function ‘cv::cvtColor‘

my solution to this problem is

file path is correct, the image format is PNG, and the required format in the code is JPG, converting PNG to JPG will solve the problem.

Read More: