簡體   English   中英

QML疊加在攝像機視頻上

[英]QML overlay on the camera video

我試圖在Qt / QML的Camera objet捕獲的幀上繪制一些疊加層。 相機本身定義為:

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。

像這樣嗎

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM