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. Overlay Qpaint on Camera example
Forum Updated to NodeBB v4.3 + New Features

Overlay Qpaint on Camera example

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 304 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
    rtvideo
    wrote on last edited by rtvideo
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

        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
        0

        • Login

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