Connect slider to control zoom on qml Camera

I use a camera to shoot movies.
I want to use the slider to scale the video, for example, scaling google map.
I found another Question about SO , but the proposed solution works for clicks, while I would like to develop a solution for the slider.
I wrote code that does not work correctly. I did not find an error, but the video size will be very large, then I do not see the video. I am trying to install digitalZoom for a camera, but I have this error: The camera does not support zooming. . I know that my camera does not support DigitalZoom and OpticalZoom. I want to find a way to enlarge the image taken from the camera.
My camera is dino ccd. Excuse me, my friends, I can’t add a comment, I have this error: "You must have 50 reputation for comments."

VideoOutput { id: viewfinder source: camera anchors.fill: parent focus : true transform: [ Scale { id: zoomScale }, Translate { id: zoomTranslate } ] //Keys.onLeftPressed: viewfinder.seek(viewfinder.position - 5000) //Keys.onRightPressed: viewfinder.seek(viewfinder.position + 5000) MouseArea { anchors.fill: parent acceptedButtons: Qt.AllButtons onClicked: { var zoomIn = mouse.button === Qt.LeftButton; zoomScale.origin.x = mouse.x; zoomScale.origin.y = mouse.y; } } Slider { id:zoomVideo orientation: Qt.Vertical minimumValue: 0 maximumValue: 100 stepSize: 10 onValueChanged: { zoomScale.xScale = zoomVideo.value zoomScale.yScale = zoomVideo.value } } } 
+5
source share
1 answer

Are you trying to implement the function of scaling / zooming out using the slider, as a regular application for mobile cameras does, if so, then consider the unverified code snippet below, because currently I do not have a machine with Qt IDE installed, but this should help you understand the concept.

  Camera { id: camera digitalZoom:zoomSlider.value //if opticalZoom is supported uncomment below line //opticalZoom:zoomSlider.value // rest of your settings } VideoOutput { id: viewfinder source: camera anchors.fill: parent focus : true } Slider { id:zoomSlider orientation: Qt.Vertical minimumValue: 0 maximumValue: camera.maximumDigitalZoom //or camera.maximumOpticalZoom stepSize:camera.maximumDigitalZoom/10 // going through 10 steps value:1.0 // initial zoom level anchors{ left:parent.left leftMargin:5 verticalCenter:parent.verticalCenter } } 

and also I would like you to take a look at the official documentation for these types. Slider , Camera . If you need further clarification, write comments below.

0
source

Source: https://habr.com/ru/post/1260122/


All Articles