OpenCV output on V4l2

空扰寡人 提交于 2019-12-22 08:23:15

问题


I wanted to know if I can use "opencv" to write on a v4l2 device. I would take a picture, apply small changes with the features of opencv, and then send it on a v4l2 device.

I searched on the web, but there are a lot of examples on how to read from a V4L2 device, but I found nothing about writing on v4l2.

can someone help me?


回答1:


The question is 8 month old, but if you still need an answer (I suppose your OS is Linux):

  1. Install v4l2 loopback module

    1.1. Load and configure it linux: i.e. modprobe.conf: options v4l2loopback video_nr=22,23

  2. Use such C++/OpenCV code: gist

    2.1. Setup device using ioctl() call

    2.2. Write raw RGB data to this device (i.e. /dev/video23)

    2.3. Use it as regular v4l2 device (i.e. webcam or vlc v4l2:///dev/video23)

more: You can use ffmpeg with v4l2 loopback: ffmpeg -f x11grab -r 12 -s 1920x1080 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 -vf 'scale=800:600' /dev/video22



来源:https://stackoverflow.com/questions/34416189/opencv-output-on-v4l2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!