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. PinchArea scale in and scale out touch coordinates
Forum Updated to NodeBB v4.3 + New Features

PinchArea scale in and scale out touch coordinates

Scheduled Pinned Locked Moved QML and Qt Quick
21 Posts 3 Posters 5.4k 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.
  • B Offline
    B Offline
    beemaneni
    wrote on last edited by
    #4

    Hi,
    I really dont understand that will solve the problem.Consider
    *1st pinch: scale is 2.0 and previousScale: 0 *when we pinch again
    2nd Pinch: scale is 3.0 and previousScale: 2 .so now u can say we scale-in ...bt at the next time we scale-in only a small amount so that
    3rd pinch: scale is 1.5 and previousScale: 3
    consider pinch as scale-out now
    4th pinch: scale is 2 and previous scale: 1.5
    5thpinch: scale is 3 and previousScale: 2

    By this way how can we figure out?
    I am very much confused.If possible can u figure out anything with this?

    Thanks in Advance

    With Regards
    Bala

    Bala B
    Infinite Computer systems
    Chennai

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #5

      Did you see "this":http://developer.nokia.com/community/wiki/How_to_handle_pinch_gestures_using_PinchArea_item example ? May be onPinchStarted and onPinchUpdated handlers would be of interest to you.

      157

      1 Reply Last reply
      0
      • B Offline
        B Offline
        beemaneni
        wrote on last edited by
        #6

        hi p3c0
        Thanks for ur interest and i have seen that.that works well for pinch and zoom of an image ,bt further ater pinch and scale i need to set zoom value for camera.what value do i set for that and hw do i find that?

        Thanks
        Bala beemaneni

        Bala B
        Infinite Computer systems
        Chennai

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #7

          Is that needed ? Can't you directly use the pinch.scale to set the zoom ?

          157

          1 Reply Last reply
          0
          • B Offline
            B Offline
            beemaneni
            wrote on last edited by
            #8

            Every time pinch starts it resets to 1.So i used like
            pinch.scale += pinch.previousScale

            Even this does not give proper values as previousScale and scale are always equal.

            Bala B
            Infinite Computer systems
            Chennai

            1 Reply Last reply
            0
            • p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by
              #9

              Created the following sample, it zooms the camera as expected. Can you try it ?
              @
              Item {
              width: Screen.width
              height: Screen.height

              Camera {
                  id: camera
                  imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
              
                  exposure {
                      exposureCompensation: -1.0
                      exposureMode: Camera.ExposurePortrait
                  }
              
                  flash.mode: Camera.FlashRedEyeReduction
              }
              
              VideoOutput {
                  source: camera
                  anchors.fill: parent
                  focus : visible // to receive focus and capture key events when visible
              }
              
              PinchArea {
                  anchors.fill: parent
                  pinch.minimumScale: 0.1
                  pinch.maximumScale: 1
                  onPinchUpdated: camera.setDigitalZoom(pinch.scale)
              }
              

              }
              @

              157

              1 Reply Last reply
              0
              • B Offline
                B Offline
                beemaneni
                wrote on last edited by
                #10

                Did u capture the image and check?
                There is a marginal difference between the image captured and the amount of image zoomed for capture..

                Bala B
                Infinite Computer systems
                Chennai

                1 Reply Last reply
                0
                • p3c0P Offline
                  p3c0P Offline
                  p3c0
                  Moderators
                  wrote on last edited by
                  #11

                  No i didn't as the question didn't say so. I thought you were struggling with the zooming using PinchArea and hence the above example. May be you should alter your question now ? Can you post what you have tried ?

                  157

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    beemaneni
                    wrote on last edited by
                    #12

                    Here the requirement goes as
                    I should start the camera and zoom in zoom out the source and capture the image.
                    my code is
                    @Camera {
                    id: cameraObj
                    captureMode: Camera.CaptureStillImage

                        onDigitalZoomChanged: {
                            pathText.text = cameraObj.digitalZoom.toString()
                        }
                        imageCapture {
                            resolution: "960x1280"
                           onImageCaptured: {
                              // some stuff here
                            }
                            onImageSaved: {           
                             // similar 
                            }
                     }
                    VideoOutput {
                        id: viewfinderBack
                        source: cameraObj
                        anchors.fill: parent
                        autoOrientation: true
                        focus: visible
                    }
                    

                    PinchArea {
                    id: pincharea
                    anchors.fill: parent
                    pinch.target: viewfinderBack
                    pinch.minimumScale: 1.0
                    pinch.maximumScale: 4.0 // max cam zoom

                        onPinchStarted: {
                        }
                        onPinchUpdated: {
                          // Here th code should find out whether user is scaled in or scaled out.
                           cameraObj.setDigitalZoom(pinch.scale)
                        }
                    

                    }
                    @

                    Hi check out this and let me know ..

                    Bala B
                    Infinite Computer systems
                    Chennai

                    1 Reply Last reply
                    0
                    • p3c0P Offline
                      p3c0P Offline
                      p3c0
                      Moderators
                      wrote on last edited by
                      #13

                      Yes there's a difference in the captured image and that the VideoOutput shows. I also tried "this":http://qt-project.org/doc/qt-5/qtmultimedia-declarative-camera-example.html QML camera example it too does that same. Can you check it if it works for you ?

                      157

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        beemaneni
                        wrote on last edited by
                        #14

                        Hi thanks for ur interest..

                        I have seen that example already and they dont use pincharea for scale in and scale out.Instead they use mousearea .So that was not helpful as i tried implementing same logic to pincharea..

                        Thanks
                        Bala Beemaneni

                        Bala B
                        Infinite Computer systems
                        Chennai

                        1 Reply Last reply
                        0
                        • p3c0P Offline
                          p3c0P Offline
                          p3c0
                          Moderators
                          wrote on last edited by
                          #15

                          I wanted to say that in that example also even if you digital zoom to the max and take the picture the result is not the same as expected. May be this is a bug, not sure though.

                          157

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            beemaneni
                            wrote on last edited by
                            #16

                            oh that is weird...i have nt checked that..let me check and update you

                            Thanks
                            Bala Beemaneni

                            Bala B
                            Infinite Computer systems
                            Chennai

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              beemaneni
                              wrote on last edited by
                              #17

                              Hi
                              it captures the accurate image only..the example is quite good enough.
                              As pinch and zoom is common in all mobiles now ,the logic should be pretty simple.Hope i am missing some basic stuff.
                              i am struggling with this for so long almost an month..Can i get any help other than qt forum ? can u suggest any?

                              Thanks Bala Beemaneni

                              Bala B
                              Infinite Computer systems
                              Chennai

                              1 Reply Last reply
                              0
                              • p3c0P Offline
                                p3c0P Offline
                                p3c0
                                Moderators
                                wrote on last edited by
                                #18

                                Since the example is working properly, can you check the following scenario ?

                                1. from declarative-camera example, zoom to highest level and capture the pic.
                                2. from your app, zoom to the highest level and capture the pic.

                                Compare these two pics if they are identical. Since both of them have set the digital zoom level to the highest which i assume is 4x, both captured pics must be identical.

                                157

                                1 Reply Last reply
                                0
                                • B Offline
                                  B Offline
                                  beemaneni
                                  wrote on last edited by
                                  #19

                                  Hi
                                  I would like to tel u onething here...if i set the zoom level manually to 1 or 2 or ...4 it works same as the example model.Both pics are identical.But the problem here is we are not able to sink the scale in value to zoom value.the camera viewfinder value i.e: the visible portion of the screen and captured portion of an image are not equal.Hope u know this already..
                                  Here wen i scale in ,based on scale portion zoom value has to be set.

                                  Thanks

                                  Bala B
                                  Infinite Computer systems
                                  Chennai

                                  1 Reply Last reply
                                  0
                                  • p3c0P Offline
                                    p3c0P Offline
                                    p3c0
                                    Moderators
                                    wrote on last edited by
                                    #20

                                    bq. But the problem here is we are not able to sink the scale in value to zoom value

                                    One way to check this would be to check what are the actual values that are passed to setDigitalZoom function in the declarative-camera example when one zoom's it using the slider. These values can then be checked with the values that you set to setDigitalZoom which you receive when you Pinch. May be there's a difference, a multiplication factor or something like that.

                                    157

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      beemaneni
                                      wrote on last edited by
                                      #21

                                      hi
                                      i was trying the above method..it seems to be quite painful..But certainly there seems to be a multiplication factor .Meanwhile if u get any ideas please let me know

                                      Thanks

                                      Bala B
                                      Infinite Computer systems
                                      Chennai

                                      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