Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Overlay Qpaint on Camera example

    General and Desktop
    2
    3
    102
    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.
    • R
      rtvideo last edited by rtvideo

      I want to overlay two rectangles on top of the video stream from the camera example project.

      void Camera::paintEvent(QPaintEvent * /*event*/)
      {
          QPainter p{this};
          p.setPen(Qt::blue);
          p.drawRect(QRect(500,40,260,140));
          p.drawRect(QRect(700,0,150,150));
      }
      

      Right now this code successfully paints two rectangles, the only issue is it does not overlay on top of the video stream and it is behind it. How would i get it to be the top layer on the GUI so it overlaps the video stream.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Are you doing any image processing ?

        Depending on what you want to do, you may have to use a custom QAbstractVideoSurface to modify the video frame before showing it.

        A QVideoFilterRunnable might also be a solution but I think it requires QtQuick for the GUI.

        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 Reply Quote 0
        • R
          rtvideo last edited by

          I want to be able to create the rectangles as 640x480 and then be able to perform bitmap functions on them to crop the photo when a trigger is sent to only capture what is inside the 640x480 rectangles.

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