Navigation

    VEYE IMAGING Forum

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Recent
    • Popular
    • Users
    • WIKI
    • veye.cc

    UNSOLVED OpenCV VEYE-MIPI-IMX462 Demo Sketches result in error

    VEYE MIPI camera
    2
    4
    721
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jakobvol last edited by

      Hello,
      I tried very hard to get the YEYE-MIPI-IMX462 working with openCV on a raspberry pi4. But not even the example VEYE-OpenCV sketches are working my configuration.

      I want to explain my problem and system as detailed as possible:

      My installation steps:

      wget https://github.com/veyeimaging/raspberrypi_v4l2/releases/latest/download/raspberrypi_v4l2.tgz
      tar -xzvf raspberrypi_v4l2.tgz
      cd raspberrypi_v4l2/release/
      chmod +x *
      sudo ./install_driver.sh veyecam2m
      
      sudo apt-get install gstreamer1.0-tools
      sudo apt-get install libx264-dev libjpeg-dev
      sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-tools gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
      
      sudo apt install python3-opencv
      pip install opencv-python
      

      I already tried:

      pip uninstall opencv-python
      sudo apt install python3-opencv
      

      like it was written in that post:
      https://forum.veye.cc/topic/274/opencv-无法找到摄像头/9?_=1685312066853
      But then the line

      import cv2
      

      causes an error, because it is not found

      At least the Camera works:
      Veye Cam IMX462 Camera works with VLC
      also over Gstreamer with following Command:

      gst-launch-1.0 v4l2src io-mode=dmabuf device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! v4l2convert capture-io-mode=dmabuf output-io-mode=dmabuf ! autovideosink sync=false -v
      

      I tried already 32bit and 64bit Pi OS (Bullseye)

      But when I try out the openCV examples on Github
      https://github.com/veyeimaging/raspberrypi_v4l2/tree/main/samples/opencv/yuv_camera
      then I get following errors:

      (tflite1-env) jakob@raspberrypi:~/tflite1 $ python3 v4l2_opencv_show1.py 
      [ WARN:0@0.020] global cap_v4l.cpp:982 open VIDEOIO(V4L2:/dev/video0): can't open camera by index
      [ WARN:0@0.022] global obsensor_stream_channel_v4l2.cpp:82 xioctl ioctl: fd=3, req=-2140645888
      [ WARN:0@0.022] global obsensor_stream_channel_v4l2.cpp:138 queryUvcDeviceInfoList ioctl error return: 25
      [ERROR:0@0.026] global obsensor_uvc_stream_channel.cpp:156 getStreamChannelGroup Camera index out of range
      Could not open video device
      Traceback (most recent call last):
        File "/home/jakob/tflite1/v4l2_opencv_show1.py", line 31, in <module>
          cv2.imshow("preview",frame)
      cv2.error: OpenCV(4.7.0) /tmp/pip-install-wqewn1vq/opencv-python_91754d4f925f4fa5a2cdc530dd257fb8/opencv/modules/highgui/src/window.cpp:971: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
      
      (tflite1-env) jakob@raspberrypi:~/tflite1 $ python3 v4l2_opencv_show2.py 
      camera open failed
      Traceback (most recent call last):
        File "/home/jakob/tflite1/v4l2_opencv_show2.py", line 21, in <module>
          read_cam()
        File "/home/jakob/tflite1/v4l2_opencv_show2.py", line 17, in read_cam
          cv2.destroyAllWindows()
      cv2.error: OpenCV(4.7.0) /tmp/pip-install-wqewn1vq/opencv-python_91754d4f925f4fa5a2cdc530dd257fb8/opencv/modules/highgui/src/window.cpp:1266: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvDestroyAllWindows'
      
      (tflite1-env) jakob@raspberrypi:~/tflite1 $ python3 v4l2_opencv_show3.py 
      [ERROR:0@0.021] global cap.cpp:164 open VIDEOIO(CV_IMAGES): raised OpenCV exception:
      
      OpenCV(4.7.0) /tmp/pip-install-wqewn1vq/opencv-python_91754d4f925f4fa5a2cdc530dd257fb8/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 io-mode=dmabuf device=/dev/video0 ! video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080 ! v4l2convert capture-io-mode=dmabuf ! video/x-raw, format=(string)BGR ! appsink in function 'icvExtractPattern'
      
      
      camera open failed
      Traceback (most recent call last):
        File "/home/jakob/tflite1/v4l2_opencv_show3.py", line 20, in <module>
          read_cam()
        File "/home/jakob/tflite1/v4l2_opencv_show3.py", line 16, in read_cam
          cv2.destroyAllWindows()
      cv2.error: OpenCV(4.7.0) /tmp/pip-install-wqewn1vq/opencv-python_91754d4f925f4fa5a2cdc530dd257fb8/opencv/modules/highgui/src/window.cpp:1266: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvDestroyAllWindows'
      

      I also tried to write a pipeline with Gstreamer to OpenCV
      with pipelines like following:

      cap = cv2.VideoCapture("gst-launch-1.0 v4l2src device=/dev/video0  ! video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1 ! videoscale ! video/x-raw,width=640,height=480 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink", cv2.CAP_GSTREAMER)
      

      But I was not able to get the Veye Cam IMX 462 in OpenCV working.
      I was spending the whole Weekend trying to get this working, but I have no further Idea what to try. Please help me :))))

      Thank you very very much in advance!

      References:
      https://wiki.veye.cc/index.php/VEYE-MIPI-290/327_for_Raspberry_Pi
      https://www.waveshare.com/wiki/IMX462_2MP_Starlight_Camera
      https://wiki.veye.cc/index.php/V4L2_mode_for_Raspberry_Pi#Stream_to_OpenCV
      https://qengineering.eu/install-gstreamer-1.18-on-raspberry-pi-4.html

      Versions:
      Raspbian GNU/Linux 11 (bullseye) (32bit)
      GStreamer Core Library version 1.18.4
      OpenCV - cv2 version: 4.7.0
      On a Raspberry Pi 4B 4gb

      veye_xumm 1 Reply Last reply Reply Quote 0
      • veye_xumm
        veye_xumm @jakobvol last edited by

        @jakobvol
        Hi,
        At the current time, I don't think there's a need for a complicated installation of gstreamer and opencv.
        I am using the Raspberry Pi OS with desktop and recommended software version of pios downloaded from the official Raspberry Pi website.
        After installing the camera driver and running sudo apt install python3-opencv, I am able to run the samples without any issues.

        1 Reply Last reply Reply Quote 0
        • J
          jakobvol last edited by

          Hm weird. I thought I tried that already. I will check it again next weekend, when I have time.

          But Thanks a lot for your reply :))

          veye_xumm 1 Reply Last reply Reply Quote 0
          • veye_xumm
            veye_xumm @jakobvol last edited by

            @jakobvol Sure, you give it a try and let me know if there are still any issues.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post