Unable to query number of channels
when I am using opencv-3.0.0 function VideoCapture cap(0); It throws a error VIDEOIO ERROR: V4L: device /dev/video0: Unable to query number of channels
Here is my code :
#include "opencv2/opencv.hpp"
using namespace cv:
int main(int,char**)
{
VideoCapture cap(0);
if(!cap.isOpened())
return -1;
Mat edges;
namedWindow("edges",1);
for(;;)
{
Mat frame;
cap >> frame;
cvtColor(frame,edges,COLOR_BGR2GRAY);
GaussianBlur(edges,edges,Size(7,7),1.5,1.5);
Canny(edges,edges,0,30,3);
imshow("edges",edges);
if(waitKey(30)>=0)
break;
}
}
Can someone help me what might be the issue,btw I am using MIPI camera to Tinker Board
"I am using MIPI camera to Tinker Board"
unfortunately, the problem is not in your code, but that v4l could not open the capture properly.
did you build with gstreamer support ? there seems to be hope, it works better with that, than V4l.
Hi berak, Yeah, I used Gstreamer with opencv-3.0.0 ,but I'm getting v4l2 issue
Errors facing: 1.VIDEOIO ERROR: V4L: device /dev/video0: Unable to query number of channels 2.cap_gstreamer.cpp:383: error: (-2) GStreamer: unable to start pipeline here, is my code for it :
cv::VideoCapture cap(" v4l2src device=/dev/video0 num-buffers=50 ! video/x-raw,format=NV12,width=640,height=480,framerate=20/1 ! videoconvert ! ximagesink ! appsink");