[ui] ImageGallery: introduce IntrinsicsIndicator

New IntrinsicsIndicator component that displays the initialization mode of each Viewpoint's intrinsic with explanatory tooltip.
This commit is contained in:
Yann Lanthony 2019-01-21 10:35:29 +01:00
parent 7db38abdf0
commit 663a5d679d
5 changed files with 144 additions and 24 deletions

View file

@ -0,0 +1,94 @@
import QtQuick 2.9
import QtQuick.Controls 2.4
import MaterialIcons 2.2
import Utils 1.0
/**
* Display camera initialization status and the value of metadata
* that take part in this process.
*/
MaterialLabel {
id: root
property string intrinsicInitMode
property var metadata: ({})
// access useful metadata
readonly property string make: metadata["Make"]
readonly property string model: metadata["Model"]
readonly property string focalLength: metadata["Exif:FocalLength"]
readonly property string focalLength35: metadata["Exif:FocalLengthIn35mmFilm"]
readonly property string bodySerialNumber: metadata["Exif:BodySerialNumber"]
readonly property string lensSerialNumber: metadata["Exif:LensSerialNumber"]
readonly property string sensorWidth: metadata["AliceVision:SensorWidth"]
readonly property string sensorWidthEstimation: metadata["AliceVision:SensorWidthEstimation"]
property string statusText: ""
property string detailsText: ""
property string helperText: ""
text: MaterialIcons.camera
function metaStr(value) {
return value || "<i>undefined</i>"
}
ToolTip.text: "<b>Camera Intrinsics: " + statusText + "</b><br>"
+ (detailsText ? detailsText + "<br>" : "")
+ (helperText ? helperText + "<br>" : "")
+ "<br>"
+ "[Metadata]<br>"
+ " - Make: " + metaStr(make) + "<br>"
+ " - Model: " + metaStr(model) + "<br>"
+ " - FocalLength: " + metaStr(focalLength) + "<br>"
+ ((focalLength && sensorWidth) ? "" : " - FocalLengthIn35mmFilm: " + metaStr(focalLength35) + "<br>")
+ " - SensorWidth: " + metaStr(sensorWidth) + (sensorWidthEstimation ? " (estimation: "+ sensorWidthEstimation + ")" : "")
+ ((bodySerialNumber || lensSerialNumber) ? "" : "<br><br>Warning: SerialNumber metadata is missing.<br> Images from different devices might incorrectly share the same camera internal settings.")
state: intrinsicInitMode ? intrinsicInitMode : "unknown"
states: [
State {
name: "calibrated"
PropertyChanges {
target: root
color: Colors.green
statusText: "Calibrated"
detailsText: "Focal Length has been initialized externally."
}
},
State {
name: "estimated"
PropertyChanges {
target: root
statusText: sensorWidth ? "Estimated" : "Approximated"
color: sensorWidth ? Colors.green : Colors.yellow
detailsText: "Focal Length was estimated from Metadata" + (sensorWidth ? " and Sensor Database." : " only.")
helperText: !sensorWidth ? "Add your Camera Model to the Sensor Database for more accurate results." : ""
}
},
State {
name: "unknown"
PropertyChanges {
target: root
color: focalLength ? Colors.orange : Colors.red
statusText: "Unknown"
detailsText: "Focal Length could not be determined from metadata. <br>"
+ "The default Field of View value was used as a fallback, which may lead to inaccurate result or failure."
helperText: "Check for missing Image metadata"
+ (make && model && !sensorWidth ? " and/or add your Camera Model to the Sensor Database." : ".")
}
},
State {
// fallback status when initialization mode is unset
name: "none"
PropertyChanges {
target: root
visible: false
}
}
]
}