I am trying to draw some overlay on the frame captured by the Camera objet in Qt/QML. The camera itself is defined as:
Camera {
id: camera
captureMode: Camera.CaptureVideo
}
VideoOutput {
source: camera
focus : visible
anchors.fill: parent
}
Now when I call camera.videorecorder.record()
, the camera starts recording and the current frame is displayed on the video output canvas. Now, what I would like to do is draw a rectangle at some arbitrary location on the frame.
I see that there are some shader effects example (http://doc.qt.io/qt-5/qtmultimedia-multimedia-video-qmlvideofx-example.html) but they look really complicated for what I want to do and I am not versed with GLSL.
Something like this?
Camera {
id: camera
captureMode: Camera.CaptureVideo
}
VideoOutput {
source: camera
focus : visible
anchors.fill: parent
Rectangle {
color: "red";
width: parent.width / 2;
height: parent.height / 2;
anchors.centerIn: parent;
}
}
Edit: This will work too:
Camera {
id: camera
captureMode: Camera.CaptureVideo
}
VideoOutput {
source: camera
focus : visible
anchors.fill: parent
}
Rectangle {
color: "red";
width: parent.width / 2;
height: parent.height / 2;
anchors.centerIn: parent;
}