iVS3D v2.0.0
Loading...
Searching...
No Matches
lib3d::ots::ColmapWrapper Class Reference

Wrapperclass for integration of COLMAP. More...

#include <colmapwrapper.h>

Inheritance diagram for lib3d::ots::ColmapWrapper:

Classes

struct  SJob
 Struct holding information of a single job. More...
 
struct  SProduct
 Struct holding information of a single product. More...
 
struct  SSequence
 Struct holding information of a single sequence. More...
 
struct  SSettings
 
struct  SSetupResults
 
struct  SWorker
 Struct holding information of current worker state. More...
 

Public Types

enum  EConnectionType { LOCAL = 0 , SSH }
 Enum holding the type of connection to COLMAP. More...
 
enum  EJobState { JOB_DONE = 0 , JOB_RUNNING , JOB_PENDING , JOB_FAILED }
 Enum holding job states. More...
 
enum  EWorkerState { WORKER_IDLE = 0 , WORKER_RUNNING , WORKER_FAILED }
 Enum holding worker states. More...
 
enum  EProductType { CAMERA_POSES = 0 , DENSE_CLOUD , MESHED_MODEL , CUSTOM_COMMAND }
 Enum holding product types that can be processed with Agisoft Metashape. More...
 

Public Slots

void setLocalColmapBinPath (const QString &colmapBinPath)
 Set absolute path to COLMAP binary on local machine.
 
void setLocalOpenMVSBinPath (const QString &openMVSBinPath)
 Set absolute path to OpenMVS binary folder on local machine.
 
void setRemoteColmapBinPath (const QString &remoteColmapBinPath)
 Set absolute path to COLMAP binary on remote machine.
 
void setRemoteOpenMVSBinPath (const QString &openMVSBinPath)
 Set absolute path to OpenMVS binary folder on remote machine.
 
void setLocalWorkspacePath (const QString &localWorkspacePath)
 Set absolute path to workspace on local machine.
 
void setRemoteWorkspacePath (const QString &remoteWorkspacePath)
 Set absolute path to workspace on remote machine.
 
void setMntPntRemoteWorkspacePath (const QString &mntPntRemoteWorkspacePath)
 Set path to mount point of remote workspace.
 
void setConnectionType (const EConnectionType &connection)
 Set connection type to Metashape.
 
void setRemoteAddr (const QString &remoteAddr)
 Set address of remote server. If empty it assumed that Metashape runs on local machine.
 
void setRemoteUsr (const QString &remoteUsr)
 Set user on remote server.
 
void setSyncInterval (int intervalInSeconds)
 Set interval (in seconds) in which the client and server should be synchronized.
 
void setUseRobustMode (bool useRobustMode)
 Set wether to use robustMode.
 
void setCustomCommands (QList< QPair< QString, QString > > customCommands)
 Set the custom command.
 
bool checkWorkerState ()
 Method to check worker state.
 
void addJob (const SJob &iJob)
 Add new job to the end of the list.
 
void addJobList (const std::vector< SJob > &iJobList)
 Append list of Jobs to the end of the current list.
 
bool moveJobOneUp (const SJob &iJob)
 Move given Job one up in queue.
 
bool moveJobOneDown (const SJob &iJob)
 Move given Job one down in queue.
 
bool deleteJob (const SJob &iJob)
 Delete given Job.
 
SJobgetJobPtrAtIdx (int iIdx)
 Returns job at given index.
 
int getNumJobs () const
 Returns Number of Jobs in Queue.
 
int removeFinishedJobs ()
 Remove finished jobs from list.
 
void clearAvailableSequenceList ()
 Remove all available sequences from list.
 
std::vector< SSequencegetFinishedSequenceList () const
 
std::vector< SJobgetJobList () const
 Get list with available (i.e. already processed) sequences.
 
EWorkerState getWorkerState () const
 Get state of worker.
 
QString getProductFilePath (QString iSeqName, const EProductType &iProdType)
 Get path of file for given product in sequence.
 
void startProcessing ()
 Method to invoke processing of job queue by COLMAP.
 
void openColmapLogFile ()
 Method to open COLMAP Log File.
 
void installScriptFilesIntoWorkspace ()
 Method to install script files into workspace.
 
bool hasScriptFilesInstalled ()
 check if script files are already installed
 
void readSettings ()
 Read settings from settings-file specified in the ColmapWrapper().
 
void writeSettings ()
 Write settings to settings-file specified in the ColmapWrapper().
 
void writeWorkQueueToFile ()
 Write work queue to file (colmap_work_queue.yaml) in workspace.
 
void clearWorkerStateFile ()
 Clear worker state file (colmap_worker_state.yaml) in workspace.
 
QString getFirstMatchingFileNameWithWildcard (const QString &path, QString baseName) const
 Return the first file with a wildcard suffix.
 
void readWorkQueueFromFile ()
 Read work queue from file (colmap_work_queue.yaml) in workspace.
 
void readWorkerStateFromFile ()
 Read worker state from file (colmap_worker_state.yaml) in workspace.
 
void afterSettingsChanged ()
 Sync files and update job list after colmap wrapper settings changed.
 

Signals

void sequenceListUpdate ()
 Signal that the list of available sequences is updated and should be reloaded.
 
void jobListUpdate ()
 Signal that the list of outstanding jobs is updated and should be reloaded.
 
void workerStateUpdate ()
 Signal that the state of the MetashapeWorker has updated.
 
void workspaceStatusUpdate ()
 Signal that the state of the workspace has updated.
 
void setupStatusUpdate ()
 Signal that the setup has changed.
 
void settingsTested (bool valid)
 settingsTested is emitted once all tests have finished.
 
void settingsApplied ()
 Signal that new colmap settings have been applied.
 

Public Member Functions

 ColmapWrapper (const QString iSettingsFile="lib3D_ColmapWrapper.ini", const bool iSettingsOnly=false)
 Constructor.
 
virtual ~ColmapWrapper ()
 Destructor.
 
void init ()
 Initialization routine.
 
bool testSettings (const SSettings *settings, SSetupResults *results)
 
QString localColmapBinPath () const
 Returns absolute path to COLMAP binary on local machine.
 
QString localOpenMVSBinPath () const
 Returns absolute path to OpenMVS binary on local machine.
 
QString remoteColmapBinPath () const
 Returns absolute path to COLMAP binary on remote machine.
 
QString remoteOpenMVSBinPath () const
 Returns absolute path to OpenMVS binary on remote machine.
 
QString localWorkspacePath () const
 Returns absolute path to workspace on local machine.
 
QString remoteWorkspacePath () const
 Returns absolute path to workspace on remote machine.
 
QString mntPntRemoteWorkspacePath () const
 Returns path to mount point of remote workspace on local machine.
 
QList< QPair< QString, QString > > customCommands () const
 Returns custom command.
 
EConnectionType connectionType () const
 Returns type of connection to COLMAP.
 
QString remoteAddr () const
 Returns address of remote server.
 
QString remoteUsr () const
 Returns user on remote server which is allowed to run COLMAP.
 
int syncInterval () const
 Returns interval (in seconds) in which the client and server should be synchronized.
 
void setChecksDisabled (const bool noChecks)
 Set the use of expert mode.
 
bool areChecksDisabled () const
 Returns true if expert mode is activated.
 
bool useRobustMode ()
 Returns wether robustMode should be used.
 
bool setUseRobustMode () const
 Set wether robustMode should be used.
 
bool isRemoteWorkspaceMounted (QString iRemoteWorkspacePath) const
 Returns true, if remote workspace is mounted. False, otherwise.
 
ui::ColmapWrapperControlsFactorygetOrCreateUiControlsFactory ()
 Method to get or create a pointer to a factory object that allows to create ui controls for the ColmapWrapper.
 
void applySettings (const SSettings *settings)
 switchWorkspace tries to switch to the local/remote workspace.
 

Static Public Member Functions

static QString EProductType2QString (const ColmapWrapper::EProductType iType)
 Convert product type to string.
 
static ColmapWrapper::EProductType QString2EProductType (const QString iStr)
 Convert string to product type.
 

Public Attributes

QString mLocalWorkspacePath
 Absolute path to workspace on local machine.
 
QString mRemoteWorkspacePath
 Absolute path to workspace on remote machine.
 

Private Member Functions

void exportJobs (cv::FileStorage &ioFileStorage) const
 Export jobs within mJobs into given cv::FileStorage object.
 
void exportJob (cv::FileStorage &ioFileStorage, const SJob &iJob) const
 Export given job into given cv::FileStorage object.
 
void importJob (const cv::FileNode &iFileNode, SJob &oJob) const
 Import job from given cv::FileNode object.
 
bool hasSequence (const std::string iSeqName) const
 Returns true, if sequence with given sequence name is available.
 
bool hasProduct (const std::string iSeqName, const ColmapWrapper::EProductType iPdctType) const
 Returns true, if product with given of given type is available in sequence.
 
void moveJobInQueue (const int fromidx, const int toIdx)
 Move job in queue.
 
int getIndexOfJob (const SJob &iJob)
 

Private Attributes

QSettings mSettings
 Settings object.
 
bool mNoChecks
 flag wether to use expert mode, in which some 'user-guidance' features ar deactivated
 
bool mUseRobustMode
 flag wether to use robust mode
 
QList< QPair< QString, QString > > mCustomCommands
 input field for custom commands
 
QTemporaryDir * mpTempDir
 Pointer to temporary directory.
 
QProcess * mpPyWorkerProcess
 Process for Python worker.
 
QProcess * mpMountProcess
 Process for mounting operations.
 
QTimer mCheckWorkerTimer
 Timer object to chech worker file server and client.
 
SWorker mPyWorker
 Member object of Python worker.
 
QStringList mPyWorkerArguments
 Arguments for Python worker.
 
QString mLocalColmapBinPath
 Absolute path to COLMAP binary on local machine.
 
QString mLocalOpenMVSBinPath
 Absolute path to OpenMVS binary folder on local machine.
 
QString mRemoteColmapBinPath
 Absolute path to COLMAP binary on remote machine.
 
QString mRemoteOpenMVSBinPath
 Absolute path to OpenMVS binary folder on remote machine.
 
QString mMntPntRemoteWorkspacePath
 Absolute path to temporary mount location of remote directory.
 
EConnectionType mConnectionType
 Connection to location of Metashape.
 
QString mRemoteAddr
 
QString mRemoteUsr
 User on remote server.
 
int mSyncInterval
 Interval of background synchronization between server and client.
 
std::vector< SSequencemAvailableSequences
 List of available sequences.
 
std::vector< SJobmJobs
 List of job pointers.
 
ui::ColmapWrapperControlsFactorympUiControls
 Pointer to UiControlsFactory object.
 
bool mSetupSuccessful = false
 current status of the setup, true if colmap can be used
 

Detailed Description

Member Enumeration Documentation

◆ EConnectionType

Enum holding the type of connection to COLMAP.

Enumerator
LOCAL 

Local connection. I.e. COLMAP is on the same machine as the programming invoking this class.

SSH 

Remote connection via SSH.

◆ EJobState

Enum holding job states.

Enumerator
JOB_DONE 

Job is done.

JOB_RUNNING 

Job is running.

JOB_PENDING 

Job is waiting to be processed.

JOB_FAILED 

Job failed to be processed.

◆ EProductType

Enum holding product types that can be processed with Agisoft Metashape.

Enumerator
CAMERA_POSES 

Camera poses / Sparse point cloud

DENSE_CLOUD 

Dense point cloud

MESHED_MODEL 

Meshed 3D model

CUSTOM_COMMAND 

Custom Command

◆ EWorkerState

Enum holding worker states.

Enumerator
WORKER_IDLE 

Worker is ideling.

WORKER_RUNNING 

Worker is running. I.e. currently processing a job.

WORKER_FAILED 

Worker has terminated unexpected.

Constructor & Destructor Documentation

◆ ColmapWrapper()

lib3d::ots::ColmapWrapper::ColmapWrapper ( const QString  iSettingsFile = "lib3D_ColmapWrapper.ini",
const bool  iSettingsOnly = false 
)
explicit

Constructor.

Parameters
[in]iSettingsFilePath to settings file of ColmapWrapper. Default: "lib3D_ColmapWrapper.ini"
[in]iSettingsOnlyAllows to instantiate class only to edit setting. Wrapper can later be initialize with init();

Member Function Documentation

◆ checkWorkerState

bool lib3d::ots::ColmapWrapper::checkWorkerState ( )
slot

Method to check worker state.

Returns
True if running Job has changed. False, otherwise.

◆ deleteJob

bool lib3d::ots::ColmapWrapper::deleteJob ( const SJob iJob)
slot

Delete given Job.

Returns
True, if successful. False, if job is not found in list.

◆ getFinishedSequenceList

std::vector< ColmapWrapper::SSequence > lib3d::ots::ColmapWrapper::getFinishedSequenceList ( ) const
slot
Returns
List with available (i.e. already processed) sequences.

◆ getIndexOfJob()

int lib3d::ots::ColmapWrapper::getIndexOfJob ( const SJob iJob)
private
Returns
Returns index of given job in queue.

Returns -1 if job is not in queue.

◆ getOrCreateUiControlsFactory()

ui::ColmapWrapperControlsFactory * lib3d::ots::ColmapWrapper::getOrCreateUiControlsFactory ( )

Method to get or create a pointer to a factory object that allows to create ui controls for the ColmapWrapper.

Returns
Pointer to object.

◆ getProductFilePath

QString lib3d::ots::ColmapWrapper::getProductFilePath ( QString  iSeqName,
const EProductType iProdType 
)
slot

Get path of file for given product in sequence.

Parameters
[in]iSeqNameName of the sequence which holds the product.
[in]iProdTypeProduct type for which the file path is to be returned.

◆ hasProduct()

bool lib3d::ots::ColmapWrapper::hasProduct ( const std::string  iSeqName,
const ColmapWrapper::EProductType  iPdctType 
) const
private

Returns true, if product with given of given type is available in sequence.

Parameters
[in]iSeqNameName of sequence for which a product is to be queried.
[in]iPdctTypeType of product that is to be queried.

◆ hasSequence()

bool lib3d::ots::ColmapWrapper::hasSequence ( const std::string  iSeqName) const
private

Returns true, if sequence with given sequence name is available.

Parameters
[in]iSeqNameName of sequence that is to be queried.

◆ importJob()

void lib3d::ots::ColmapWrapper::importJob ( const cv::FileNode &  iFileNode,
ColmapWrapper::SJob oJob 
) const
private

Import job from given cv::FileNode object.

Parameters
[out]oJobJob that is imported from file.

◆ init()

void lib3d::ots::ColmapWrapper::init ( )

Initialization routine.

Performs the following steps:

  1. Initializes the synchronization timers.
  2. File system mount of the remote workspace via sshfs if applicable.
  3. Synchronizes the workspace and initally populates the list of available products.

◆ moveJobInQueue()

void lib3d::ots::ColmapWrapper::moveJobInQueue ( const int  fromidx,
const int  toIdx 
)
private

Move job in queue.

Parameters
[in]fromidxIndex pointing to job that is to be moved.
[in]toIdxIndex to which the job is to be moved.

◆ moveJobOneDown

bool lib3d::ots::ColmapWrapper::moveJobOneDown ( const SJob iJob)
slot

Move given Job one down in queue.

Returns
True, if successful. False, if job is not found in list.

◆ moveJobOneUp

bool lib3d::ots::ColmapWrapper::moveJobOneUp ( const SJob iJob)
slot

Move given Job one up in queue.

Returns
True, if successful. False, if job is not found in list.

◆ removeFinishedJobs

int lib3d::ots::ColmapWrapper::removeFinishedJobs ( )
slot

Remove finished jobs from list.

Returns
Number of removed jobs.

◆ settingsTested

void lib3d::ots::ColmapWrapper::settingsTested ( bool  valid)
signal

settingsTested is emitted once all tests have finished.

Parameters
valid

◆ testSettings()

bool lib3d::ots::ColmapWrapper::testSettings ( const SSettings settings,
SSetupResults results 
)

check remote colmap

check mount of remote workspace

Member Data Documentation

◆ mRemoteAddr

QString lib3d::ots::ColmapWrapper::mRemoteAddr
private

Address of remote server. If empty it assumed that Metashape runs on local machine. Default = "".


The documentation for this class was generated from the following files: