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. Inverted Qimage when implementing QAbstractVideoSurface on windows
Forum Updated to NodeBB v4.3 + New Features

Inverted Qimage when implementing QAbstractVideoSurface on windows

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 1.6k Views 3 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.
  • V Offline
    V Offline
    vkini
    wrote on last edited by
    #1

    Re: [Video on StreamingVideoSurface is inverted](or not depending on whose PC runs it)

    present(const QVideoFrame &frame) is giving inverted images on Windows. I know the that DirectShow with Qt has limitation on windows, not quite sure if this is because of that or something to do with my implementation.

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

      Hi and welcome to devnet,

      Where does your image data come from ?

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

        Thank you. I have read lot of other answers by you, many thanks for the quick revert. I am taking default system camera(QCamera(QCameraInfo::defaultCamera())) and setting QAbstractVideoSurface as viewfinder to it and in present(const QVideoFrame &frame) I am creating the Qimage from the QVideoFrame.

        QVideoFrame cloneFrame(frame);
        cloneFrame.map(QAbstractVideoBuffer::ReadOnly);
        const QImage image(cloneFrame.bits(),
        		   cloneFrame.width(),
        		   cloneFrame.height(),
        		   QVideoFrame::imageFormatFromPixelFormat(cloneFrame.pixelFormat()));
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          By inverted do you mean horizontal or vertically flipped ?

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

            Image is upside down, attaching a reference image.![0_1553754454041_Capture.PNG](Uploading 100%)

            Image link on Imgur

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

              Then you can use QImage::mirrored to put it in the right direction.

              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
              • V Offline
                V Offline
                vkini
                wrote on last edited by vkini
                #7

                Hmm, not sure if that is the right thing to do. Same code on Linux shows image frames in proper orientation. On Windows I tried with 3 different camera hardwares, on 2 cameras image frame was flipped whereas on third one image was mirrored(like how a image looks infront of mirror). I think the issue is related to multimedia/directshow implementation. It seems generic fix for this is to fix in qtmultimedia.

                beeckscheB 1 Reply Last reply
                0
                • V vkini

                  Hmm, not sure if that is the right thing to do. Same code on Linux shows image frames in proper orientation. On Windows I tried with 3 different camera hardwares, on 2 cameras image frame was flipped whereas on third one image was mirrored(like how a image looks infront of mirror). I think the issue is related to multimedia/directshow implementation. It seems generic fix for this is to fix in qtmultimedia.

                  beeckscheB Offline
                  beeckscheB Offline
                  beecksche
                  wrote on last edited by
                  #8

                  @vkini

                  I don't think it's a problem of the Qt module.

                  Maybe Windows and Linux us a different coordinate systems for the Camera, Video or Image.

                  Or in the OS the Camera is preset with a mirrored option.

                  V 1 Reply Last reply
                  0
                  • beeckscheB beecksche

                    @vkini

                    I don't think it's a problem of the Qt module.

                    Maybe Windows and Linux us a different coordinate systems for the Camera, Video or Image.

                    Or in the OS the Camera is preset with a mirrored option.

                    V Offline
                    V Offline
                    vkini
                    wrote on last edited by
                    #9

                    @beecksche Probably you are right. And for me issue solves with marking it mirrored. The best thing for now would be to mark it mirrored on windows and keeping it same for Linux. Thank you @SGaist & @beecksche .

                    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