v4l2

How to write/pipe to a virtual webcam created by V4L2loopback module?

痴心易碎 提交于 2019-11-30 07:30:45
I have written an application which reads from a webcam and processes the frames using OpenCV on linux. Now I want to pipe the output of my application to a virtual webcam that has been created by the V4L2loopback module so other applications are able to read it. I have written the application using C. I am not sure how to approach doing this. Could you please give me any hints? user477519 I have found an answer in the old V4L2loopback module's page on Google code. http://code.google.com/p/v4l2loopback/source/browse/test.c newer link: https://github.com/umlaeute/v4l2loopback/blob/master

cv2.videocapture.read() does not return a numpy array

随声附和 提交于 2019-11-30 04:19:56
问题 I have this code trying to capture a frame from my webcam on raspberry pi, and saving it as an image. I use opencv 2, but I get strange errors when I run the code.. import time import sys from subprocess import call import cv2 cam = cv2.VideoCapture() while True: cam.open(-1) image = cam.read() cv2.imwrite("current.jpeg",image) time.sleep(10); This is what the program returns: VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC

v4l2 very simple example [closed]

风流意气都作罢 提交于 2019-11-30 01:04:19
I'm looking for a simple example for camera access in Linux using V4L2. Where I can find it? As simple, as possible. Thanks, Raulp Try the uvccapture code here -> http://staticwave.ca/source/uvccapture/ It is very small yet very concrete example which makes use of all the V4l2 concepts (open,set format, allocate memory, Request Buffer, Dqbuffer and Query-buffer - all intems of ioclts). uvcgrab () function is the one to look for which makes use of Dqbuffer and Query-buffer. ioctl (vd->fd, VIDIOC_DQBUF, &vd->buf); ioctl (vd->fd, VIDIOC_QBUF, &vd->buf) While Studying it you can keep looking for

OpenCV (via python) on Linux: Set frame width/height?

一个人想着一个人 提交于 2019-11-29 17:40:57
问题 I'm using openCV via python on linux (ubuntu 12.04), and I have a logitech c920 from which I'd like to grab images. Cheese is able to grab frames up to really high resolutions, but whenever I try to use openCV, I only get 640x480 images. I have tried: import cv cam = cv.CaptureFromCAM(-1) cv.SetCaptureProperty(cam,cv.CV_CAP_PROP_FRAME_WIDTH,1920) cv.SetCaptureProperty(cam,cv.CV_CAP_PROP_FRAME_WIDTH,1080) but this yields output of "0" after each of the last two lines, and when I subsequently

Android NDK open() device permission denied

风流意气都作罢 提交于 2019-11-29 15:46:38
In a native call, I'm trying to open("/dev/video4", O_RDWR) but I get errno EACCES 13 "permission denied". If I run the same code* in an executable, on the same Android host, as the same UID of the installed app I'm running above, it works fine. (* minor differences like main() instead of Java_com_test_testOpen() ) I've tried chmod 666 /dev/video4 and still get EACCES, which is especially strange. Why does the same code , on the same host , as the same user , give EACCESS when called via JNI, and success when called as standalone executable? The test device is rooted and running Cyanogenmod 12

How do I enable the UVC_QUIRK_FIX_BANDWIDTH quirk in Linux UVC Driver?

十年热恋 提交于 2019-11-29 14:37:38
问题 I am currently trying to run 2 webcams on a Wandboard board, which have to share a USB hub. Problem is , the current driver implementation (YUV only) saturates the USB hub and in the end I can only connect one camera. However the UVC driver implementation has a quirk for this kind of situation, and others. Problem is, I did not find any documentation on how to load these quirks. Could you please assist me with that? 回答1: you can change the behaviour of many kernel-modules by passing some

v4l2 very simple example [closed]

南楼画角 提交于 2019-11-28 22:01:47
问题 I'm looking for a simple example for camera access in Linux using V4L2. Where I can find it? As simple, as possible. Thanks, 回答1: Try the uvccapture code here -> http://staticwave.ca/source/uvccapture/ It is very small yet very concrete example which makes use of all the V4l2 concepts (open,set format, allocate memory, Request Buffer, Dqbuffer and Query-buffer - all intems of ioclts). uvcgrab () function is the one to look for which makes use of Dqbuffer and Query-buffer. ioctl (vd->fd,

Capturing h.264 stream from camera with Gstreamer

半腔热情 提交于 2019-11-28 21:34:41
I'm trying to capture H264 stream from locally installed Logitech C920 camera from /dev/video0 with Gstreamer 1.0 v4l2src element. v4l2-ctl --list-formats shows that camera is capable to give H264 video format: # v4l2-ctl --list-formats ioctl: VIDIOC_ENUM_FMT ... Index : 1 Type : Video Capture Pixel Format: 'H264' (compressed) Name : H.264 ... But pipeline # gst-launch-1.0 -vvv v4l2src device=/dev/video0 ! video/x-h264, width=800, height=448, framerate=30/1 ! fakesink keeps giving me not-negotiated (-4) error: /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-h264, width=

Android NDK open() device permission denied

五迷三道 提交于 2019-11-28 09:35:33
问题 In a native call, I'm trying to open("/dev/video4", O_RDWR) but I get errno EACCES 13 "permission denied". If I run the same code* in an executable, on the same Android host, as the same UID of the installed app I'm running above, it works fine. (* minor differences like main() instead of Java_com_test_testOpen() ) I've tried chmod 666 /dev/video4 and still get EACCES, which is especially strange. Why does the same code , on the same host , as the same user , give EACCESS when called via JNI,

V4L2中出现的问题

断了今生、忘了曾经 提交于 2019-11-27 16:03:08
在取出一帧数据的时候,我使用的是以下的代码: struct v4l2_buffer buf; memset(&buf, 0, sizeof(buf)); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if(ioctl(fd, VIDIOC_DQBUF, &buf) == -1) { printf("VIDIOC_DQBUF failed\n"); return -10; } printf("VIDIOC_DQBUF success\n"); 运行的结果是ioctl一直返回-1,一直无法解决这个问题 但当我在这一步之前加上select进行检测,就解决了这个问题 fd_set fds; struct timeval tv; FD_ZERO(&fds); FD_SET(fd, &fds); tv.tv_sec = 2; tv.tv_usec = 0; int ret; ret = select(fd+1, &fds, NULL, NULL, &tv); 这以上代码中设置时延来检测fd是否有数据,当fd有数据的时候,select才会返回,不然select会阻塞在那里等待; 这样子就解决了之前的问题,之前的问题是当开始启动摄像头获取数据的时候,马上使用ioctl获取一帧的数据