Vim3-ubuntu环境,如何用c语言程序获取usb摄像头的数据。

环境是vim3+ubuntu,目前的usb摄像头能够通过程序guvcview看到图像,请问如何编写c语言程序获取usb摄像头上传的图像信息呢?

@aspire 我们docs上有一个简单示例

USB 摄像头也是标准的V4L2框架,你可以自己去搜一下相关资料,很多的。

这个代码,我试了,gcc编译不过,报了很多错误

我在vim3的运行gcc命令报了以下错误:test.cpp:(.text+0x90): undefined reference to cv::VideoCapture::VideoCapture(int)' /usr/bin/ld: test.cpp:(.text+0x15c): undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)’
/usr/bin/ld: /tmp/ccodNBX0.o: in function cv::String::String(char const*)': test.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): undefined reference to cv::String::allocate(unsigned long)’
/usr/bin/ld: /tmp/ccodNBX0.o: in function cv::String::~String()': test.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x10): undefined reference to cv::String::deallocate()’
collect2: error: ld returned 1 exit status
opencv是3.4.3版本的,安装好的