[ui] Viewer2D: add FeaturesViewer + dedicated overlay

Make FeaturesViewer available in Viewer2D to display the feature points of the current view, based on the current FeatureExtraction node.

* FeaturesInfoOverlay: overlay that displays info and provides controls over a FeaturesViewer component.
* ColorChart: color picker based on a set of predefined colors.
This commit is contained in:
Yann Lanthony 2019-07-04 17:53:30 +02:00
parent 8dd0a4be22
commit 4563d32e3e
No known key found for this signature in database
GPG key ID: 519FAE6DF7A70642
4 changed files with 231 additions and 0 deletions

View file

@ -77,8 +77,39 @@ FocusScope {
visible: image.status === Image.Loading
}
// FeatureViewer: display view extracted feature points
// note: requires QtAliceVision plugin - use a Loader to evaluate plugin avaibility at runtime
Loader {
id: featuresViewerLoader
active: displayFeatures.checked
// handle rotation/position based on available metadata
rotation: {
var orientation = metadata ? metadata["Orientation"] : 0
switch(orientation) {
case "6": return 90;
case "8": return -90;
default: return 0;
}
}
x: rotation === 90 ? image.paintedWidth : 0
y: rotation === -90 ? image.paintedHeight : 0
Component.onCompleted: {
// instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
setSource("FeaturesViewer.qml", {
'active': Qt.binding(function() { return displayFeatures.checked; }),
'viewId': Qt.binding(function() { return _reconstruction.selectedViewId; }),
'model': Qt.binding(function() { return _reconstruction.featureExtraction.attribute("describerTypes").value; }),
'folder': Qt.binding(function() { return Filepath.stringToUrl(_reconstruction.featureExtraction.attribute("output").value); }),
})
}
}
}
// Busy indicator
BusyIndicator {
anchors.centerIn: parent
@ -147,6 +178,21 @@ FocusScope {
metadata: visible ? root.metadata : {}
}
Loader {
id: featuresOverlay
anchors.bottom: bottomToolbar.top
anchors.left: parent.left
anchors.margins: 2
active: displayFeatures.checked
sourceComponent: FeaturesInfoOverlay {
featureExtractionNode: _reconstruction.featureExtraction
pluginStatus: featuresViewerLoader.status
featuresViewer: featuresViewerLoader.item
}
}
FloatingPane {
id: bottomToolbar
anchors.bottom: parent.bottom
@ -163,6 +209,13 @@ FocusScope {
text: (image.status == Image.Ready ? image.scale.toFixed(2) : "1.00") + "x"
state: "xsmall"
}
MaterialToolButton {
id: displayFeatures
font.pointSize: 11
ToolTip.text: "Display Features"
checkable: true
text: MaterialIcons.scatter_plot
}
Item {
Layout.fillWidth: true