Invalid number of channels in input image
You want to do color manipulation but your image has the type CV_8U1. It has to be at least a three channel image like CV_8UC3 or CV_32F. Try a different CV_Type
Camera.set(cv::CAP_PROP_FORMAT, CV_32F);
As error message said, the image given in input to the color conversion function has an invalid number of channels.
The point is that you are acquiring frames as single 8bit channel
Camera.set(cv::CAP_PROP_FORMAT, CV_8UC1)
and then you try to convert this frame in grayscale
cv::cvtColor(image, gray, cv::COLOR_BGR2GRAY)
You have 2 easy options to solve this issue:
- you change the camera acquisition format in order to have color information in your frames, for example using CV_32S or CV_32F
- you skip the color conversion as you already have grayscale image, thus no need to convert it.
Take a look to this link for OpenCV color manipulation