OpenCV VideoCapture ()가 작동하지 않음-Ubuntu

군단

OpenCV 4.5-Ubuntu-Jetson Nano 2GB

안녕하세요 OpenCV로 웹캠 (USB로 JetsonNano에 연결)에서 비디오를 가져 오는 데 문제가 있습니다.

내 코드는 다음과 같습니다.

 // cv::VideoCapture cap( ... );
    cv::Mat frame;
    if (!cap.isOpened())  // if not success, exit program
    {
        cout << "Cannot open the video cam" << endl;
        return -1;
    }
    cv::namedWindow("test", cv::WINDOW_AUTOSIZE);
    while(true)
    {
        try
        {
            cap >> frame;
            cv::imshow("test", frame);
        }
        catch(const std::exception& e)
        {
            std::cerr << e.what() << '\n';
        }
    }

1 | cv::VideoCapture cap(0)나에게 준다 :

[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

2 | cv::VideoCapture cap("/dev/video0")나에게 준다 :

[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (1761) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module source reported: Could not read from resource.
[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Cannot open the video cam

3 | 명령으로 카메라를 열려고 할 때이 한 가지만 작동 $ gst-launch-1.0 v4l2src device=\"/dev/video0\" ! xvimagesink합니다. 시도해 cv::VideoCapture cap("v4l2src device=\"/dev/video0\" ! xvimagesink")보았습니다.

[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (803) open OpenCV | GStreamer warning: cannot find appsink in manual pipeline
[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Cannot open the video cam

다른 싱크 (자동 싱크 또는 앱 싱크)를 주면 작동하지 않습니다.

4 | 해당 링크 https://forums.developer.nvidia.com/t/sony-camera-module-cannot-be-opened-with-opencv-on-xavier/84003 에서 솔루션을 시도했습니다.

cv::VideoCapture cap("v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,format=UYVY,framerate=30/1 ! videoconvert ! video/x-raw,format=BGR ! appsink") 그리고 그것은 나에게 준다 :

[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (1761) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/legion/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ERROR:0] global /home/legion/opencv/modules/videoio/src/cap.cpp (142) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.0) /home/legion/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,format=UYVY,framerate=30/1 ! videoconvert ! video/x-raw,format=BGR ! appsink in function 'icvExtractPattern'

누군가 무슨 일이 일어나고 있고 어떻게 고칠 지 알고 있습니까?

편집 # 1 : 내 OpenCV 빌드 정보 :

General configuration for OpenCV 4.5.0 =====================================
  Version control:               unknown
  Extra modules:
    Location (extra):            /home/legion/opencv_contrib/modules
    Version control (extra):     unknown
  Platform:
    Timestamp:                   2020-11-24T13:09:24Z
    Host:                        Linux 4.9.140-tegra aarch64
    CMake:                       3.10.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               RELEASE
  CPU/HW features:
    Baseline:                    NEON FP16
      required:                  NEON
      disabled:                  VFPV3
  C/C++:
    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                /usr/bin/c++  (ver 7.5.0)
    C++ flags (Release):         -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,--gc-sections -Wl,--as-needed  
    Linker flags (Debug):        -Wl,--gc-sections -Wl,--as-needed  
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          m pthread cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu
    3rdparty dependencies:
  OpenCV modules:
    To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 cnn_3dobj cvv java js julia matlab ovis viz
    Applications:                perf_tests examples apps
    Documentation:               NO
    Non-free algorithms:         YES
  GUI: 
    GTK+:                        YES (ver 3.22.30)
      GThread :                  YES (ver 2.56.4)
      GtkGlExt:                  NO
    OpenGL support:              NO
    VTK support:                 NO
  Media I/O: 
    ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
    JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
    TIFF:                        build (ver 42 - 4.0.10)
    JPEG 2000:                   build (ver 2.3.1)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES
  Video I/O:
    DC1394:                      YES (2.2.5)
    FFMPEG:                      YES
      avcodec:                   YES (57.107.100)
      avformat:                  YES (57.83.100)
      avutil:                    YES (55.78.100)
      swscale:                   YES (4.8.100)
      avresample:                YES (3.7.0)
    GStreamer:                   YES (1.14.5)
    v4l/v4l2:                    YES (linux/videodev2.h)
  Parallel framework:            TBB (ver 2020.2 interface 11102)
  Trace:                         YES (with Intel ITT)
  Other third-party libraries:
    Lapack:                      NO
    Eigen:                       YES (ver 3.3.4)
    Custom HAL:                  YES (carotene (ver 0.0.1))
    Protobuf:                    build (3.5.1)
  NVIDIA CUDA:                   YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
    NVIDIA GPU arch:             53
    NVIDIA PTX archs:
  cuDNN:                         YES (ver 8.0.0)
  OpenCL:                        YES (no extra features)
    Include path:                /home/legion/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load
  Python 2:
    Interpreter:                 /usr/bin/python2.7 (ver 2.7.17)
    Libraries:                   /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17)
    numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
    install path:                lib/python2.7/dist-packages/cv2/python-2.7
  Python 3:
    Interpreter:                 /usr/bin/python3 (ver 3.6.9)
    Libraries:                   /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
    numpy:                       /home/legion/.local/lib/python3.6/site-packages/numpy/core/include (ver 1.19.4)
    install path:                lib/python3.6/dist-packages/cv2/python-3.6
  Python (for build):            /usr/bin/python2.7
  Java:                          
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO
  Install to:                    /usr
-----------------------------------------------------------------

고마워 ~~

Mibrahimy

포인트 1과 2의 경우 두 번째 인수를에 전달하여 테스트 할 수 있습니다 VideoCapture(filename[, apiPreference]). OpenCV가 ffmpegv4l2. 나는 다음과 같은 옵션을 시도 할 것이다 cv::CAP_FFMPEG,하고 CAP_V4L2. 포인트 4의 경우 웹캠이 1080p인지 확인하십시오.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

OpenCV VideoCapture ()가 작동하지 않음-Ubuntu

분류에서Dev

Rapsberry Pi가있는 OpenCV : VideoCapture IP 카메라가 작동하지 않음

분류에서Dev

Ubuntu 12.04 + Wifi가 작동하지 않음

분류에서Dev

Ubuntu 15.1 PGP가 작동하지 않음

분류에서Dev

Ubuntu 14 Wifi가 작동하지 않음

분류에서Dev

Ubuntu 18.04 EGPU가 작동하지 않음

분류에서Dev

Ubuntu apt가 작동하지 않음

분류에서Dev

Python OpenCV-VideoCapture.release ()는 Linux에서 작동하지 않습니다.

분류에서Dev

Asus Xtion Pro Live로 VideoCapture OpenCV에서 이미지를 가져올 수 없음

분류에서Dev

Ubuntu One 북마크 동기화가 작동하지 않음

분류에서Dev

VideoCapture에서 uEye 카메라가 감지되지 않음

분류에서Dev

Ubuntu Trusty ppa 패키지 설치가 작동하지 않음

분류에서Dev

Ubuntu 16.04에서 Texmaker 바로 가기가 작동하지 않음

분류에서Dev

Ubuntu 오디오가 이상하게 작동하지 않음 (12.04)

분류에서Dev

Ubuntu 오디오가 이상하게 작동하지 않음 (12.04)

분류에서Dev

Bengali 용 ibus-avro가 Ubuntu 13.10에서 작동하지 않음

분류에서Dev

Ubuntu 13.10-Skype가 올바르게 작동하지 않음

분류에서Dev

Inspiron 5520 설치 후 Ubuntu 13.04 WiFi가 작동하지 않음

분류에서Dev

Ubuntu 16.04 Bluetooth가 작동하지 않음 (Dell XPS13)

분류에서Dev

Ubuntu Gnome 13.04 PDF로 인쇄가 작동하지 않음

분류에서Dev

Ubuntu 16.04 nvidia 드라이버가 작동하지 않음

분류에서Dev

Ubuntu 20.04 Lenovo Ideapad 마이크가 작동하지 않음

분류에서Dev

Ubuntu 16.04에 설치 한 직후 Mariadb가 작동하지 않음

분류에서Dev

Ubuntu 12.10 Skype 웹캠 마이크가 작동하지 않음

분류에서Dev

Ubuntu 14.04 + VMware 6 : Left Ctrl 및 Right Shift가 작동하지 않음

분류에서Dev

Ubuntu 18.04 .local 도메인 DNS 조회가 작동하지 않음

분류에서Dev

Ubuntu 12.10 Skype 웹캠 마이크가 작동하지 않음

분류에서Dev

Ubuntu 16.04 nvidia 드라이버가 작동하지 않음

분류에서Dev

Ubuntu 13.10 재설치 후 Lan DNS가 작동하지 않음

Related 관련 기사

  1. 1

    OpenCV VideoCapture ()가 작동하지 않음-Ubuntu

  2. 2

    Rapsberry Pi가있는 OpenCV : VideoCapture IP 카메라가 작동하지 않음

  3. 3

    Ubuntu 12.04 + Wifi가 작동하지 않음

  4. 4

    Ubuntu 15.1 PGP가 작동하지 않음

  5. 5

    Ubuntu 14 Wifi가 작동하지 않음

  6. 6

    Ubuntu 18.04 EGPU가 작동하지 않음

  7. 7

    Ubuntu apt가 작동하지 않음

  8. 8

    Python OpenCV-VideoCapture.release ()는 Linux에서 작동하지 않습니다.

  9. 9

    Asus Xtion Pro Live로 VideoCapture OpenCV에서 이미지를 가져올 수 없음

  10. 10

    Ubuntu One 북마크 동기화가 작동하지 않음

  11. 11

    VideoCapture에서 uEye 카메라가 감지되지 않음

  12. 12

    Ubuntu Trusty ppa 패키지 설치가 작동하지 않음

  13. 13

    Ubuntu 16.04에서 Texmaker 바로 가기가 작동하지 않음

  14. 14

    Ubuntu 오디오가 이상하게 작동하지 않음 (12.04)

  15. 15

    Ubuntu 오디오가 이상하게 작동하지 않음 (12.04)

  16. 16

    Bengali 용 ibus-avro가 Ubuntu 13.10에서 작동하지 않음

  17. 17

    Ubuntu 13.10-Skype가 올바르게 작동하지 않음

  18. 18

    Inspiron 5520 설치 후 Ubuntu 13.04 WiFi가 작동하지 않음

  19. 19

    Ubuntu 16.04 Bluetooth가 작동하지 않음 (Dell XPS13)

  20. 20

    Ubuntu Gnome 13.04 PDF로 인쇄가 작동하지 않음

  21. 21

    Ubuntu 16.04 nvidia 드라이버가 작동하지 않음

  22. 22

    Ubuntu 20.04 Lenovo Ideapad 마이크가 작동하지 않음

  23. 23

    Ubuntu 16.04에 설치 한 직후 Mariadb가 작동하지 않음

  24. 24

    Ubuntu 12.10 Skype 웹캠 마이크가 작동하지 않음

  25. 25

    Ubuntu 14.04 + VMware 6 : Left Ctrl 및 Right Shift가 작동하지 않음

  26. 26

    Ubuntu 18.04 .local 도메인 DNS 조회가 작동하지 않음

  27. 27

    Ubuntu 12.10 Skype 웹캠 마이크가 작동하지 않음

  28. 28

    Ubuntu 16.04 nvidia 드라이버가 작동하지 않음

  29. 29

    Ubuntu 13.10 재설치 후 Lan DNS가 작동하지 않음

뜨겁다태그

보관