Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Flip VideoOutput left to right or upside down
Forum Updated to NodeBB v4.3 + New Features

Flip VideoOutput left to right or upside down

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 3 Posters 717 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.
  • D Offline
    D Offline
    diego-qt
    wrote on last edited by diego-qt
    #1

    Hello,

    I am using my webcam in my project.

    Camera {
        id: camera
        deviceId: //insert device id here
        captureMode: Camera.CaptureViewfinder
    }
    
    VideoOutput {
        id: viewfinder
        anchors.centerIn: parent
        height: root.height
        fillMode: VideoOutput.PreserveAspectFit
        source: camera
    }
    

    I would like the video output to show the camera flow flipped horizontally, like seeing in a mirror. Is this possible? On another note, is it possible to flip vertically to show the camera flow upside down?

    Thanks in advance.

    D 1 Reply Last reply
    0
    • D diego-qt

      Hello,

      I am using my webcam in my project.

      Camera {
          id: camera
          deviceId: //insert device id here
          captureMode: Camera.CaptureViewfinder
      }
      
      VideoOutput {
          id: viewfinder
          anchors.centerIn: parent
          height: root.height
          fillMode: VideoOutput.PreserveAspectFit
          source: camera
      }
      

      I would like the video output to show the camera flow flipped horizontally, like seeing in a mirror. Is this possible? On another note, is it possible to flip vertically to show the camera flow upside down?

      Thanks in advance.

      D Offline
      D Offline
      diego-qt
      wrote on last edited by
      #2

      The answer I came up with was this : put the VideoOutput object in an Item and use the transform property to rotate it around the Y axis, which gives it the mirror effect I was looking for.

      Item {
          transform:  Rotation {
              origin.x: width / 2
              axis { x: 0; y: 1; z: 0 }
              angle: 180
          }
      
          VideoOutput {
              id: viewfinder
              anchors.centerIn: parent
              height: parent.height
              fillMode: VideoOutput.PreserveAspectFit
              source: camera
          }
      }
      
      
      GrecKoG 1 Reply Last reply
      2
      • D diego-qt has marked this topic as solved on
      • D diego-qt

        The answer I came up with was this : put the VideoOutput object in an Item and use the transform property to rotate it around the Y axis, which gives it the mirror effect I was looking for.

        Item {
            transform:  Rotation {
                origin.x: width / 2
                axis { x: 0; y: 1; z: 0 }
                angle: 180
            }
        
            VideoOutput {
                id: viewfinder
                anchors.centerIn: parent
                height: parent.height
                fillMode: VideoOutput.PreserveAspectFit
                source: camera
            }
        }
        
        
        GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        @diego-qt can't you put the transform directly in the VideoOutput?

        Esmaeil_SooanE 1 Reply Last reply
        0
        • GrecKoG GrecKo

          @diego-qt can't you put the transform directly in the VideoOutput?

          Esmaeil_SooanE Offline
          Esmaeil_SooanE Offline
          Esmaeil_Sooan
          wrote on last edited by Esmaeil_Sooan
          #4

          @GrecKo Hi
          no, I think it`s important property that must be add to VideoOutput module.
          any way :
          simple solution is what @diego-qt said but there is another solutions like ShaderEffect and QAbstractVideoSurface.

          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