LitchiCheng/RV1106_Linux: Linux test for RV1106 dev board (github.com)
如下为调用usb摄像头,连续拍照保存的测试代码
#include <iostream>
#include "v4l2CapPicTool.h"
#include "timecost.h"
int main(int argc, char const *argv[])
{
v4l2CapPicTool vt("/dev/video0", 1080, 960, "jpg");
vt.init();
while (1){
usleep(100000);
{
timecost tmp("capture");
vt.capture();
}
{
timecost tmp("save");
vt.save("./test.jpg");
}
}
return 0;
}
同时测试,capture所花费的时间
pico@luckfox:~$ sudo ./captureJpgApp
init success
capturetime spent:0.382155sec
savetime spent:0.003527sec
capturetime spent:0.073295sec
savetime spent:0.001937sec
capturetime spent:0.030448sec
savetime spent:0.003411sec
capturetime spent:0.025701sec
savetime spent:0.001992sec
capturetime spent:0.031095sec
savetime spent:0.003586sec
capturetime spent:0.025089sec
savetime spent:0.004171sec
capturetime spent:0.02678sec
savetime spent:0.001836sec
capturetime spent:0.031064sec
savetime spent:0.001938sec
可以看到,capture所花费的时间大概在0.03s左右,也就是30ms一帧,对应就是30fps