right way to setup cv::VideoCaptureModes
In the opencv 3.4.2 documentation here , there is a provision to change the camera modes, so did I implemented as below,
int main(int argc, char argv) {
Mat frame;
VideoCapture cap(0);
if (!cap.isOpened())
{
cout << "Cannot open the video cam" << endl;
return -1;
}
while (1) {
cap.set(CAP_MODE_GRAY); // mode I want
cap.set(CAP_PROP_FRAME_WIDTH,320);
cap.set(CAP_PROP_FRAME_HEIGHT,240);
bool bSuccess = cap.read(frame);
if (!bSuccess)
{
cout << "Cannot read a frame from video stream" << endl; break;
}
imshow("simple video",frame);
if (waitKey(30) == 27)
{
cout << "esc key is pressed by user" << endl; break;
}
}
its giving the error as
5_graycapmode.cpp:40:30: error: no matching function for call to 'cv::VideoCapture::set(cv::VideoCaptureModes)' cap.set(CAP_MODE_GRAY); ^
In file included from /usr/local/include/opencv2/highgui.hpp:51:0, from /usr/local/include/opencv2/opencv.hpp:68, from 5_graycapmode.cpp:6: /usr/local/include/opencv2/videoio.hpp:778:26: note: candidate: virtual bool cv::VideoCapture::set(int, double) CV_WRAP virtual bool set(int propId, double value); ^~~ /usr/local/include/opencv2/videoio.hpp:778:26: note: candidate expects 2 arguments, 1 provided
Is it probably as my syntax is wrong??
( Its my new account so my replies are kept frozen for 48 hrs)