PinchArea scale in and scale out touch coordinates
-
Hi
I am working on pinch area and i would like to know whether i scaled in or scaled out..i was able to scale in and scale out,bt i want to know wen i scale out the image,I am bit confused with that..i tried to do with
pinch.startPoint1 and pinch.startPoint1 and pinch.point1 and pinch.point2 bt of no use and confused.
Can anyone help me with this..?My requirement is based on scaling i need to set the camera zoom...so
when scaled in i do like:
zoomvalue = prevScale + pinch.scale
when scaled out i shud do like:
zoomvalue = prevScale - pinch.scalehere i dont know when i am scaling out and i have to find out that
Please help me with some valuable answersThanks in Advance
-
Hi guys,
Do anyone know the answer...Please help me ..i am waiting for the help :-(Thanks
Bala Beemaneni -
Did you look at the previousScale value of Pinch ? When the the pinch starts it starts with value 1.0. By reading the value of scale and previous scale continuously you may figure out the either it is scale-in or scale-out.
-
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: 2By 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 -
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.
-
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 -
Is that needed ? Can't you directly use the pinch.scale to set the zoom ?
-
Every time pinch starts it resets to 1.So i used like
pinch.scale += pinch.previousScaleEven this does not give proper values as previousScale and scale are always equal.
-
Created the following sample, it zooms the camera as expected. Can you try it ?
@
Item {
width: Screen.width
height: Screen.heightCamera { 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) }
}
@ -
Did u capture the image and check?
There is a marginal difference between the image captured and the amount of image zoomed for capture.. -
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 ?
-
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.CaptureStillImageonDigitalZoomChanged: { 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 zoomonPinchStarted: { } 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 ..
-
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 ?
-
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 -
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.
-
oh that is weird...i have nt checked that..let me check and update you
Thanks
Bala Beemaneni -
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
-
Since the example is working properly, can you check the following scenario ?
- from declarative-camera example, zoom to highest level and capture the pic.
- 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.
-
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
-
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.