Skip to content

Building an Executable

mirkosprojects edited this page Jul 30, 2023 · 5 revisions

If you want to use the Command Line Node to develop your custom Meshroom program, you have to build an executable, that actually runs your program. Most Alicevision Nodes are programmed in C++, this documentation however focuses on python.

The dfm_wrapper.py get's executed by the DeepFeatureMatching Node with the commandLine shell command. Therefore, we need the dfm_analyzer.py to accept input arguments, which is possible with argsparse.

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('-sfmData', type=str, required=True)
    parser.add_argument('-imagePairs', type=str, required=True)
    parser.add_argument('-matches', type=str, required=True)
    parser.add_argument('-features', type=str, required=True)
    parser.add_argument('--minMatches', type=int)

    args = parser.parse_args()

The corresponding commandLine variable from the DeepFeatureMatching Node looks as follows.

class DeepFeatureMatching(desc.CommandLineNode):
    commandLine = 'dfm_wrapper -sfmData {sfmDataValue} -imagePairs {imagePairsValue} -matches {matchesValue} -features {featuresValue} --minMatches {minMatchesValue}'

In order for your Command Line Node to execute the dfm_wrapper.py program, you have to build the executable. A popular library to do this is pyinstaller.

pyinstaller dfm_wrapper.py --onefile    # build the program for the first time
pyinstaller dfm_wrapper.spec            # use this if you already have a dfm_wrapper.spec file

Note

The option --onefile makes sure to package everything in one executable

Pyinstaller will create the following files and directories:

  • build: Contains metadata and files used by pyinstaller internally (can be largely ignored)
  • dist: Contains the final executable
  • dfm_analyzer.spec: The spec file contains the build settings, it is automatically created

After the build is completed, you can place the executable in the aliceVision/bin directory and the Node in the lib/meshroom/nodes/aliceVision.

Project Conclusion »

Clone this wiki locally