[ui] ImageGallery: allow to visualize the list of HDR images created by LDRToHDR

Conflicts:
	meshroom/ui/reconstruction.py
This commit is contained in:
Fabien Castan 2020-03-05 20:50:36 +01:00
parent 85dd992927
commit 19d2f90554
5 changed files with 85 additions and 12 deletions

View file

@ -7,6 +7,7 @@ from threading import Thread
from PySide2.QtCore import QObject, Slot, Property, Signal, QUrl, QSizeF
from PySide2.QtGui import QMatrix4x4, QMatrix3x3, QQuaternion, QVector3D, QVector2D
import meshroom.core
from meshroom import multiview
from meshroom.common.qt import QObjectListModel
from meshroom.core import Version
@ -369,6 +370,8 @@ class Reconstruction(UIGraph):
self._buildingIntrinsics = False
self.intrinsicsBuilt.connect(self.onIntrinsicsAvailable)
self._hdrCameraInit = None
self.importImagesFailed.connect(self.onImportImagesFailed)
# - Feature Extraction
@ -394,6 +397,10 @@ class Reconstruction(UIGraph):
# - Texturing
self._texturing = None
# - LDR2HDR
self._ldr2hdr = None
self.cameraInitChanged.connect(self.updateLdr2hdrNode)
# react to internal graph changes to update those variables
self.graphChanged.connect(self.onGraphChanged)
@ -449,6 +456,8 @@ class Reconstruction(UIGraph):
self.prepareDenseScene = None
self.depthMap = None
self.texturing = None
self.ldr2hdr = None
self.hdrCameraInit = None
self.updateCameraInits()
if not self._graph:
return
@ -478,6 +487,10 @@ class Reconstruction(UIGraph):
def getCameraInitIndex(self):
if not self._cameraInit:
# No CameraInit node
return -1
if not self._cameraInit.graph:
# The CameraInit node is a temporary one not attached to a graph
return -1
return self._cameraInits.indexOf(self._cameraInit)
@ -493,6 +506,24 @@ class Reconstruction(UIGraph):
""" Set the current FeatureExtraction node based on the current CameraInit node. """
self.depthMap = self.lastNodeOfType('DepthMapFilter', self.cameraInit) if self.cameraInit else None
def updateLdr2hdrNode(self):
""" Set the current LDR2HDR node based on the current CameraInit node. """
self.ldr2hdr = self.lastNodeOfType('LDRToHDR', self.cameraInit) if self.cameraInit else None
@Slot()
def setupLDRToHDRCameraInit(self):
if not self.ldr2hdr:
self.hdrCameraInit = Node("CameraInit")
return
sfmFile = self.ldr2hdr.attribute("outSfMDataFilename").value
if not sfmFile or not os.path.isfile(sfmFile):
self.hdrCameraInit = Node("CameraInit")
return
nodeDesc = meshroom.core.nodesDesc["CameraInit"]()
views, intrinsics = nodeDesc.readSfMData(sfmFile)
tmpCameraInit = Node("CameraInit", viewpoints=views, intrinsics=intrinsics)
self.hdrCameraInit = tmpCameraInit
def lastSfmNode(self):
""" Retrieve the last SfM node from the initial CameraInit node. """
return self.lastNodeOfType("StructureFromMotion", self._cameraInit, Status.SUCCESS)
@ -778,6 +809,8 @@ class Reconstruction(UIGraph):
cameraInitChanged = Signal()
cameraInit = makeProperty(QObject, "_cameraInit", cameraInitChanged, resetOnDestroy=True)
hdrCameraInitChanged = Signal()
hdrCameraInit = makeProperty(QObject, "_hdrCameraInit", hdrCameraInitChanged, resetOnDestroy=True)
cameraInitIndex = Property(int, getCameraInitIndex, setCameraInitIndex, notify=cameraInitChanged)
viewpoints = Property(QObject, getViewpoints, notify=cameraInitChanged)
cameraInits = Property(QObject, lambda self: self._cameraInits, constant=True)
@ -970,6 +1003,9 @@ class Reconstruction(UIGraph):
texturingChanged = Signal()
texturing = makeProperty(QObject, "_texturing", notify=texturingChanged)
ldr2hdrChanged = Signal()
ldr2hdr = makeProperty(QObject, "_ldr2hdr", notify=ldr2hdrChanged, resetOnDestroy=True)
nbCameras = Property(int, reconstructedCamerasCount, notify=sfmReportChanged)
# Signals to propagate high-level messages