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. Efficient rendering of multiple raw-image streams
Forum Updated to NodeBB v4.3 + New Features

Efficient rendering of multiple raw-image streams

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.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.
  • P Offline
    P Offline
    PhilFech
    wrote on 17 Jun 2013, 15:26 last edited by
    #1

    Dear Qt friends

    I am no expert, but more or less familiar with Qt. But for my current task I don't find the solution. And I already spend several days on browsing through documentations/examples etc. and tried a lot.

    The application I want to develop: I have attached N=1..20 industrial cameras to my computer, each producing 25 frames/sec at a resolution of 2048x2048 (they provide raw uncoded images in RGB format). I am capturing the cameras in a background thread. And now I simply want to put the N images on each frame (at 25 FPS) on screen side-by-side in a tile/mosaic manner. Since I wrote the capturing background thread, I can adapt the data format or other things.

    My current attempt is to setup a QGraphicsScene and QGraphicsView. But unfortunately, as it seems, on each frame update, I have to takeover each image by

    (a) copying it into a QImage via QImage constructor,
    (b) copy-scale it to 1/Nth of the screen-size via QImage::scaledToHeight() / QImage::scaledToWidth(),
    (c) copy it into a QPixmap via QPixmap::convertFromImage()
    (d) copy it into the scene via QGraphicsPixmapItem::setPixmap()

    This is terribly slow and inefficient! I thought, there should be a way, to register a QImage to QGraphicsScene/QGraphicsView, so that it is always shown as I want it (in a tile besides others or full-screen, the whole image or only a zoomed part of it). And I thought, updating such a QImage with a newly captured camera frame should be easy, but I see no way for loading a new image into an existing QImage. Even better would be, to get access to the image memory inside QImage - in that way, I could convert the data directly from camera-native format into Qt-native format, without any unnecessary copying.

    I am very happy about any feedback! Is my approach feasible? Are there other better ways? Do I have to change only a little detail or my complete thinking? Thanks a lot.

    Best wishes,
    Philipp

    1 Reply Last reply
    0
    • 8 Offline
      8 Offline
      8majkel8
      wrote on 17 Jun 2013, 16:40 last edited by
      #2

      maybe use opengl textures and custom OpenGL widget to simply draw them.

      You could simply read frames from camera into this textures.

      To refresh view you will have to periodicly call update() on that widget.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cincirin
        wrote on 17 Jun 2013, 18:00 last edited by
        #3

        For Graphics View I would subclass QGraphicsItem and reimplement paint method. In every subclass you can add a QImage member and draw it in paint function. Also you can directly manipulate QImage pixels with QImage::bits and then QGraphicsItem::update to show them

        1 Reply Last reply
        0
        • P Offline
          P Offline
          PhilFech
          wrote on 19 Jun 2013, 14:41 last edited by
          #4

          Thank's a lot! Yes, the later approach of cincirin works quite well. Acutally, some collegues of mine also mentioned, I should use OpenGl (as proposed by 8majkel8). But, since I am performing only simple 2D operations, I liked to omit OpenGl. Thank's again.

          Best wishes,
          Philipp

          1 Reply Last reply
          0

          1/4

          17 Jun 2013, 15:26

          • Login

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