Camera Preview Full Screen
Unsolved
QML and Qt Quick
-
Hello, I am using the Camera element for my android application, the camera opens successfully and I can take an image. I'm getting the output with VideoOutput. I want to make this preview full screen. Can you help me?
fillMode: VideoOutput.Stretch
The fillMode above works, but the camera image is distorted. How can I set the aspect ratio?
Full Code
import QtQuick import QtQuick.Controls import QtQuick.Layouts import QtMultimedia Page { MediaDevices { id: deviceList } Camera { id: mainCamera active: true cameraDevice: deviceList.defaultVideoInput focusMode: Camera.FocusModeAutoNear } CaptureSession { camera: mainCamera videoOutput: videoOutput } VideoOutput { id: videoOutput anchors.fill: parent fillMode: VideoOutput.Stretch } Component.onCompleted: { mainCamera.active = false mainCamera.active = true } }
Result
-
@NullByte said in Camera Preview Full Screen:
VideoOutput
Have you tried different types of
fillMode
?
fillMode : enumerationSet this property to define how the video is scaled to fit the target area. Stretch - the video is scaled to fit. PreserveAspectFit - the video is scaled uniformly to fit without cropping PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary The default fill mode is PreserveAspectFit.
https://doc.qt.io/qt-5/qml-qtmultimedia-videooutput.html#fillMode-prop