ubuntu系统(六):ubuntu系统使用usb相机汇总

0.前言       

        目前多使用usb-cam这个c++的功能包来打开usb摄像头以及发布图像话题,但是目前不能够比较容易修改usb-cam驱动包的分辨率,导致1080p的usb摄像头不能发挥其功能。

        使用摄像头1080p(1920*1080像素)

        下面是一些摸索(先把线索列在这里,稍后整理-----)

1.opencv打开usb摄像头并配置1080p分辨率

python3 使用 Opencv 打开 USB摄像头,配置1080P分辨率_人工智能-CSDN博客_python打开usb摄像头import cv2import timecap = cv2.VideoCapture(0)cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc('M', 'J', 'P', ...https://blog.csdn.net/zhqh100/article/details/82382860      使用改方法可以录制视频,但是目前还不能够发布高分辨率的话题(稍后继续看看---)

2.使用v4l2-ctrl和ffmeg解决usb摄像头低分辨率问题

linux系统下 USB 摄像头1080分辨率采集帧率低问题的解决方法_wutong_login的专栏-CSDN博客_usb摄像头分辨率linux系统上一般使用 video4linux2来操作系统摄像。1.安装一个 v4l2-ctrl工具:sudo apt install v4l-utils2.查看摄像头支持的视频参数sudo v4l2-ctl --all --list-formats-ext显示信息参考如下(这是我的摄像头,不同的摄像头会有区别):------ioctl: VIDIOC_ENUM...https://blog.csdn.net/wutong_login/article/details/102920557        目前可以看到opencv图像窗口视频,但是存在报错,以及没有获取到图像话题(稍后可以写个包试试----)

[meng@meng ~/shanghai2022/camera/scriptts]$ python open_1080p.py 
Corrupt JPEG data: 802 extraneous bytes before marker 0xd9
1642774761.39
Corrupt JPEG data: 809 extraneous bytes before marker 0xd9
1642774761.45
Corrupt JPEG data: 836 extraneous bytes before marker 0xd9
1642774761.47
Corrupt JPEG data: 853 extraneous bytes before marker 0xd9
1642774761.5
Corrupt JPEG data: 863 extraneous bytes before marker 0xd9
1642774761.52
Corrupt JPEG data: 883 extraneous bytes before marker 0xd9
1642774761.55
Corrupt JPEG data: 830 extraneous bytes before marker 0xd9
1642774761.57

3.usb-cam包

usb_cam - ROS Wikihttp://wiki.ros.org/usb_cam        目前直接在launch文件里面修改分辨率以及像素类型pixel_format,修改及报错如下:



  
    
     
    
    
    

        
    
    
    
    
    
  


 
[ INFO] [1642774166.907134769]: using default calibration URL
[ INFO] [1642774166.907195595]: camera calibration URL: file:///home/meng/.ros/camera_info/head_camera.yaml
[ INFO] [1642774166.907247238]: Unable to open camera calibration file [/home/meng/.ros/camera_info/head_camera.yaml]
[ WARN] [1642774166.907269518]: Camera calibration file /home/meng/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1642774166.907301796]: Starting 'head_camera' (/dev/video0) at 1920x1080 via mmap (mjpeg) at 30 FPS
[ WARN] [1642774167.040079472]: unknown control 'white_balance_temperature_auto'

[ WARN] [1642774167.043163428]: unknown control 'focus_auto'

[mjpeg @ 0xd681e0] Changeing bps to 8
[ERROR] [1642774169.005591214]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.038777947]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.077739537]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.118118882]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.158286388]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.197898472]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.238226538]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.278087973]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.318747495]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.358017210]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.398832932]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.438121581]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200
[ERROR] [1642774169.478890826]: outbuf size mismatch.  pic_size: 3110400 bufsize: 4147200

4.cv_camera c++功能包

cv_camera - ROS Wikihttp://wiki.ros.org/cv_camera

GitHub - OTL/cv_camera: ROS opencv camera driver that uses cv::VideoCapturehttps://github.com/OTL/cv_camera

        没有改源码,分辨率稳定在800*400,giao~(未完-----)

你可能感兴趣的:(ubuntu使用,ubuntu,linux,运维)