实现检测阈值设置。

This commit is contained in:
luocai
2024-12-13 16:57:00 +08:00
parent dbe7c1a64e
commit fd494f2a03
7 changed files with 203 additions and 69 deletions

View File

@ -18,6 +18,8 @@ Item {
property bool antiClipAreaEnabled: false
property int antiClipSensitivity: 1
property alias helmetThreshold: helmetInput.text
property alias headThreshold: headInput.text
property alias detectFrameSize: detectFrameInput.text
property alias flip: flipSwitch.checked
property alias videoRotation: rotateComboBox.currentIndex
@ -248,13 +250,12 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
columns: 6
columns: 2
Label { text: qsTr("图像: ") }
Row {
enabled: root.enabled
Layout.columnSpan: 5
Label {
anchors.verticalCenter: parent.verticalCenter
text: qsTr("旋转")
@ -282,9 +283,9 @@ Item {
Label {
text: qsTr("开门区域: ")
}
Row {
enabled: root.enabled
Layout.columnSpan: 5
RadioButton {
text: "关闭"
checked: App.currentOpenDoorAreaWay ==DeviceConnection.Diabled
@ -308,63 +309,131 @@ Item {
}
}
Label {
Layout.alignment: Qt.AlignTop
Layout.topMargin: 14
text: qsTr("防夹区域: ")
}
Label {text: qsTr("防夹区域: ")}
Row {
enabled: root.enabled
Layout.columnSpan: 1
RadioButton {
text: "关闭"
checked: !App.currentAntiClipAreaEnabled
onToggled: {
App.currentAntiClipAreaEnabled=false
Flow{
Layout.fillHeight: true
Layout.fillWidth: true
RowLayout {
enabled: root.enabled
RadioButton {
text: "关闭"
checked: !App.currentAntiClipAreaEnabled
onToggled: {
App.currentAntiClipAreaEnabled=false
}
}
RadioButton {
text: "四边形"
checked: App.currentAntiClipAreaEnabled
onToggled: {
App.currentAntiClipAreaEnabled=true
}
Layout.rightMargin: 20
}
}
RadioButton {
text: "四边形"
checked: App.currentAntiClipAreaEnabled
onToggled: {
App.currentAntiClipAreaEnabled=true
RowLayout {
Label { text: qsTr("灵敏度: ")
Layout.alignment: Qt.AlignRight
}
ComboBox {
id: antiClipSensitivityComboBox
enabled: root.enabled
implicitWidth: 60
Layout.alignment: Qt.AlignLeft
model: [1,2,3,4,5]
currentIndex: root.antiClipSensitivity-1
onCurrentIndexChanged: {
App.currentAntiClipSensitivity = antiClipSensitivityComboBox.currentIndex+1
}
Layout.rightMargin: 20
}
}
RowLayout {
Label { text: qsTr("安全帽阈值: ")
Layout.alignment: Qt.AlignRight
}
TextField {
id: helmetInput
enabled: root.enabled
implicitWidth: 60
Layout.alignment: Qt.AlignLeft
selectByMouse: true
ToolTip.visible: helmetInput.hovered
ToolTip.text: "阈值范围 0-300"
validator: IntValidator {
bottom: 0
top: 300
}
onAccepted: {
if(App.currentHelmetThreshold !== parseInt(helmetInput.text)){
App.currentHelmetThreshold= parseInt(helmetInput.text)
window.showSuccess("设置成功",2500)
}
}
Layout.rightMargin: 20
}
}
}
Label { text: qsTr("灵敏度: ")
Layout.alignment: Qt.AlignRight
}
ComboBox {
id: antiClipSensitivityComboBox
enabled: root.enabled
implicitWidth: 60
Layout.alignment: Qt.AlignLeft
model: [1,2,3,4,5]
currentIndex: root.antiClipSensitivity-1
onCurrentIndexChanged: {
App.currentAntiClipSensitivity = antiClipSensitivityComboBox.currentIndex+1
RowLayout {
Label { text: qsTr("头肩阈值: ")
Layout.alignment: Qt.AlignRight
}
TextField {
id: headInput
enabled: root.enabled
implicitWidth: 60
Layout.alignment: Qt.AlignLeft
selectByMouse: true
ToolTip.visible: headInput.hovered
ToolTip.text: "阈值范围 0-300"
validator: IntValidator {
bottom: 0
top: 300
}
onAccepted: {
if(App.currentHeadThreshold !== parseInt(headInput.text)){
App.currentHeadThreshold= parseInt(headInput.text)
window.showSuccess("设置成功",2500)
}
}
Layout.rightMargin: 20
}
}
}
Label { text: qsTr("安全帽阈值: ")
Layout.alignment: Qt.AlignRight
}
TextField {
id: helmetInput
enabled: root.enabled
implicitWidth: 60
Layout.alignment: Qt.AlignLeft
validator: IntValidator {
bottom: 0
top: 300
}
onAccepted: {
if(App.currentHelmetThreshold !== parseInt(helmetInput.text)){
App.currentHelmetThreshold= parseInt(helmetInput.text)
window.showSuccess("设置成功",2500)
RowLayout {
Label { text: qsTr("识别帧数: ")
Layout.alignment: Qt.AlignRight
}
TextField {
id: detectFrameInput
enabled: root.enabled
implicitWidth: 60
Layout.alignment: Qt.AlignLeft
selectByMouse: true
ToolTip.visible: detectFrameInput.hovered
ToolTip.text: "帧数范围 0-30"
validator: IntValidator {
bottom: 0
top: 30
}
onAccepted: {
if(App.currentDetectFrameSize !== parseInt(detectFrameInput.text)){
App.currentDetectFrameSize= parseInt(detectFrameInput.text)
window.showSuccess("设置成功",2500)
}
}
}
}
}
Label {text: qsTr("屏蔽区域: ")}
Row {
id: shieldedRow

View File

@ -122,6 +122,8 @@ ApplicationWindow {
antiClipSensitivity: App.currentAntiClipSensitivity
antiClipAreaPoints: App.currentAntiClipAreaPoints
helmetThreshold: App.currentHelmetThreshold
headThreshold: App.currentHeadThreshold
detectFrameSize: App.currentDetectFrameSize
flip: App.currentDeviceFlip
videoRotation: App.currentDeviceRotation
}