Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Resizing a constant Video stream from OpenCV to PyQt5 with QPainter in a QWidget using a Raspberry Pi

Resizing a constant Video stream from OpenCV to PyQt5 with QPainter in a QWidget using a Raspberry Pi

Scheduled Pinned Locked Moved Unsolved Language Bindings
qwidgetpyqtopencvqpainterpython
24 Posts 2 Posters 18.4k Views
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #14

    Why are you calling del cam just before sys.exit(app.exec_()) ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xenoshell
      wrote on last edited by Xenoshell
      #15

      I just tried if it would solve the "Segmentation fault" error but it didnt work.
      Well can you give me another point in the right direction?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #16

        Don't delete objects while you are using them ;)

        Can you get a stack trace of the crash ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • X Offline
          X Offline
          Xenoshell
          wrote on last edited by Xenoshell
          #17

          Ok, it seems like its not possible to catch a Segmentation fault error with stack trace. I used "gdb" to get some information about the error. Here is the output:

          (gdb) run qt.py 
          Starting program: /usr/bin/python3 qt.py
          [Thread debugging using libthread_db enabled]
          Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
          [New Thread 0x720a7470 (LWP 20003)]
          [New Thread 0x716ff470 (LWP 20004)]
          
          ** (python3:19975): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
          [New Thread 0x6ff00470 (LWP 20007)]
          [New Thread 0x6f5ff470 (LWP 20008)]
          [New Thread 0x6e6ab470 (LWP 20022)]
          [Thread 0x6e6ab470 (LWP 20022) exited]
          [New Thread 0x6e6ab470 (LWP 20023)]
          [Thread 0x6e6ab470 (LWP 20023) exited]
          Venus USB2.0 Camera
          [<PyQt5.QtMultimedia.QCameraInfo object at 0x72fde030>]
          Capturemode supported
          
          Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
          0x7344b620 in platform_get_handle () from /opt/vc/lib/libEGL.so
          
          

          I read many threads about this problem and it could be that i run out of memory. Since Geany-Output is:

          Segmentation fault
          ------------------
          (program exited with code: 139)
          Press return to continue
          
          

          and code :139 means "attempt to access a virtual address which is not in your address space"

          EDIT: the problem could also occur because some of the modules are written in C++. I read that some problems can happen because of this

          here is more output of gdb that "should" give more info

          (gdb) bt
          #0  0x733d4620 in platform_get_handle () from /opt/vc/lib/libEGL.so
          #1  0x733c9f2c in eglCreateWindowSurface () from /opt/vc/lib/libEGL.so
          #2  0x722e7004 in ?? ()
             from /usr/lib/arm-linux-gnueabihf/qt5/plugins/xcbglintegrations/libqxcb-egl-integration.so
          Backtrace stopped: previous frame identical to this frame (corrupt stack?)
          
          1 Reply Last reply
          0
          • X Offline
            X Offline
            Xenoshell
            wrote on last edited by Xenoshell
            #18

            Ok, well i can give you some more info. It seems that the Segmentation fault is because of this line self.camvfind.show() or the line after that. I just tested this with putting print("1") after every line and looking how many lines of 1s get printed.

            Also someone from stackoverflow wrote this :"Most likely there is a race condition in some of the modules you load and someone accesses memory before someone else has set it up. It looks like the program is looking for a handle in libEGL and that function is triggering the segfault."
            This person also suggested that i look at the memory load of the program but it doesnt seem to matter because the memory load is sometimes high and it works and sometimes its lower and it doesnt work

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #19

              Do you have several versions of Qt installed on your device ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • X Offline
                X Offline
                Xenoshell
                wrote on last edited by Xenoshell
                #20

                I have qt5 and qt4 but i deinstalled qt4 and some folders are still left. They are in: /usr/lib/arm-linux-gnueabihf/qt4
                /usr/share/qt4
                Also output of qmake --version is :

                QMake version 3.0
                Using Qt version 5.7.1 in /usr/lib/arm-linux-gnueabihf
                
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #21

                  How did you install PyQt ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    Xenoshell
                    wrote on last edited by Xenoshell
                    #22

                    I tried to install PyQt from source but it always gave me an error so i just used sudo apt-get install pyqt5-dev/pyqt5-dev-tools/python3-pyqt5.qtmultimedia.
                    I also wrote my question with Segmentation Fault on other forums and someone said: "There is a buffer overflow happening in the eglCreateWindowSurface function". To be honest i dont know exactly what to do with this or how this would help me with my problem. The eglCreateWindowSurface function has something with openGl to do, maybe there is a problem with it? You got an idea?

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #23

                      Do you have the latest version of Raspbian running ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • X Offline
                        X Offline
                        Xenoshell
                        wrote on last edited by Xenoshell
                        #24

                        Yeah i feel like i do sudo apt-get update && upgrade at least once a day. I just checked about SIP and i compiled it from source but i cant remember if i actually used the command make and make install. Does that mean i have to reinstall pyqt5 again? I guess i just open a new thread. Thanks for all the help @SGaist

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved