0

我正在尝试在 Qt/QML 中的 Camera 对象捕获的帧上绘制一些叠加层。相机本身定义为:

Camera {
    id: camera
    captureMode: Camera.CaptureVideo
}
VideoOutput {
    source: camera
    focus : visible 
    anchors.fill: parent
}

现在,当我打电话时camera.videorecorder.record(),相机开始录制,当前帧显示在视频输出画布上。现在,我想做的是在框架上的任意位置绘制一个矩形。

我看到有一些着色器效果示例(http://doc.qt.io/qt-5/qtmultimedia-multimedia-video-qmlvideofx-example.html)但对于我想做的事情来说它们看起来真的很复杂,我是不熟悉 GLSL。

4

1 回答 1

3

像这样的东西?

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;
   }
}

编辑: 这也可以:

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;
}
于 2016-06-14T05:20:08.963 回答