UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    QML camera feed is reversed

    Scheduled Pinned Locked Moved App Development
    pythondevelopmentcamera
    1 Posts 1 Posters 617 Views 1 Watching
    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.
    • B Offline
      b15h0y
      last edited by

      Hello, I just started developing a simple image processing app with qml and python and had question regarding setting up the camera feed.

      My Main.qml file currently has:

      import QtQuick 2.7
      import QtMultimedia 5.4
      import Ubuntu.Components 1.3
      import QtQuick.Layouts 1.3
      import Qt.labs.settings 1.0
      import io.thp.pyotherside 1.3
      
      MainView {
          id: root
          objectName: 'mainView'
          applicationName: 'example-hello.none'
          automaticOrientation: true
          width: units.gu(45)
          height: units.gu(75)
      
          Page {
              id:main
              anchors.fill: parent
              width: 640
              height: 360
      
              header: PageHeader {
              id: header
              title: i18n.tr('Camera')
              }
      
              Camera {
                  id: camera
                  imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
                  exposure {
                      exposureCompensation: -1.0
                      exposureMode: Camera.ExposurePortrait
                  }
                  flash.mode: Camera.FlashRedEyeReduction
                  imageCapture {
                      onImageCaptured: {
                          photoPreview.source = preview  // Show the preview in an Image
                      }
                  }
                  transform: Rotation { origin.x: 25; origin.y: 25; angle: 45}
      
              }
      
              VideoOutput {
                  source: camera
                  anchors.fill: parent
                  focus : visible // to receive focus and capture key events when visible
              }
      
              Image {
                  id: photoPreview
              }
              
          }
      
      //declare a variable to import a Python module
          Python {
              id: python
      
              //connect main.py
              Component.onCompleted: {
                  addImportPath(Qt.resolvedUrl('../src/'));
                  importModule_sync("main")
              }
      
              onError: {
                  console.log('python error: ' + traceback);
              }          
          }
      }
      

      Camera is working but the view is flipped, I tried using a Transform to rotate it but the app crashes, what am I missing here? also is it possible to send the camera feed in real time to a python function in my main.py file that I linked at the end?

      Testing device : Volla Phone
      note: normal camera app is working properly, so the issue is code related

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post