lqsa
25th October 2015, 22:15
Hi,
I would like to capture a 80x80 image from the Camera:
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtMultimedia 5.5
Item {
Column {
VideoOutput {
x: 0
y: 0
width: 80
height: 80
source: camera
fillMode: VideoOutput.PreserveAspectCrop
Camera {
id: camera
position: Camera.FrontFace
imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
exposure {
exposureCompensation: -1.0
exposureMode: Camera.ExposurePortrait
}
flash.mode: Camera.FlashRedEyeReduction
imageCapture {
resolution: Qt.size(80, 80)
onImageCaptured: {
photo.source = preview
}
}
}
}
Image {
id: photo
width: 80
height: 80
}
Button {
width: 50
height: 20
onClicked: camera.imageCapture.capture()
}
}
}
The VideoOuput shows the image correctly, 80x80 cropped image, but when the button is clicked and captures the image, the image captured isn't cropped and has a resolution of 640x480 pixels.
How can I capture what is showing the VideoCapture (a 80x80 pixels cropped image)?
I would like to capture a 80x80 image from the Camera:
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtMultimedia 5.5
Item {
Column {
VideoOutput {
x: 0
y: 0
width: 80
height: 80
source: camera
fillMode: VideoOutput.PreserveAspectCrop
Camera {
id: camera
position: Camera.FrontFace
imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
exposure {
exposureCompensation: -1.0
exposureMode: Camera.ExposurePortrait
}
flash.mode: Camera.FlashRedEyeReduction
imageCapture {
resolution: Qt.size(80, 80)
onImageCaptured: {
photo.source = preview
}
}
}
}
Image {
id: photo
width: 80
height: 80
}
Button {
width: 50
height: 20
onClicked: camera.imageCapture.capture()
}
}
}
The VideoOuput shows the image correctly, 80x80 cropped image, but when the button is clicked and captures the image, the image captured isn't cropped and has a resolution of 640x480 pixels.
How can I capture what is showing the VideoCapture (a 80x80 pixels cropped image)?