Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Best way to process cv::Mat 's in threads? intell tbb & QThread with event messaging or QThrealPoll ?
Qt 6.11 is out! See what's new in the release blog

Best way to process cv::Mat 's in threads? intell tbb & QThread with event messaging or QThrealPoll ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.0k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by
    #1

    Hi,

    I am getting mp4 stream from my source permanently . And processing each frame .

    My current processing speed is almost 1/4 of the frame per second of the stream.

    So I can get benefit from using 4 or more threads to distribute the images for processing.

    I need a simple examle and direction to follow :

    1 - create 5 threads and move the process class to them and use signal / slot mechanism to send receive images/results ?

    2 - Create thread pool and use it ?

    3 - try to dive intel tbb

    any simple example very appreciated.

    Best

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

      Hi,

      You have to give more information about what you are doing.

      What are the properties of your video streams ? mp4 has a lot of possibilities.

      What processing are you doing ?
      Are you just showing the result or also recording it ?

      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
      • R Offline
        R Offline
        RahibeMeryem
        wrote on last edited by
        #3

        @SGaist Hi,

        I am extracting frames as Mat object and making object detection on each frame. It is mostly mp4 sometimes rtsp streams.

        I am detection object and signalling the resulting coordinates and the detected square location.

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

          That I understood but extracting/processing frames from small sized streams is not the same as doing in for 4k streams.

          IIRC, OpenCV provides support for GPU processing, that might be an interesting option.

          QThreadPool might be more interesting as it will use as much threads as it makes sense.

          In any case, TBB might be a nice tool to learn.

          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
          • R Offline
            R Offline
            RahibeMeryem
            wrote on last edited by
            #5

            @SGaist

            I am trying signal slot connection to distribute frames :) little stupid.

            one idea is the putting a shared QQueue and pulling frames from threads to process

            What is the best approach to wait Queue is not empty without wasting cpu time ?

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

              A QWaitCondition might be interesting.

              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

              • Login

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