mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-26 21:17:29 +02:00
move photogrammetryPipeline to new multiview module
This commit is contained in:
parent
ce6925117a
commit
84945c52bb
2 changed files with 40 additions and 34 deletions
|
@ -1,42 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
|
||||||
|
|
||||||
import meshroom.core
|
import meshroom.core
|
||||||
|
from meshroom import multiview
|
||||||
from meshroom.core import graph as pg
|
from meshroom.core import graph as pg
|
||||||
|
|
||||||
|
|
||||||
def photogrammetryPipeline(imageDirectory):
|
|
||||||
graph = pg.Graph('pipeline')
|
|
||||||
cameraInit = graph.addNewNode('CameraInit',
|
|
||||||
sensorDatabase=os.environ.get('ALICEVISION_SENSOR_DB', 'sensor_width_camera_database.txt'))
|
|
||||||
if imageDirectory:
|
|
||||||
cameraInit.imageDirectory.value = imageDirectory
|
|
||||||
featureExtraction = graph.addNewNode('FeatureExtraction',
|
|
||||||
input=cameraInit.outputSfm)
|
|
||||||
# TODO: imageMatching
|
|
||||||
featureMatching = graph.addNewNode('FeatureMatching',
|
|
||||||
input=cameraInit.outputSfm,
|
|
||||||
featuresDirectory=featureExtraction.output)
|
|
||||||
structureFromMotion = graph.addNewNode('StructureFromMotion',
|
|
||||||
input=cameraInit.outputSfm,
|
|
||||||
featuresDirectory=featureExtraction.output,
|
|
||||||
matchesDirectory=featureMatching.output)
|
|
||||||
prepareDenseScene = graph.addNewNode('PrepareDenseScene',
|
|
||||||
input=structureFromMotion.output)
|
|
||||||
camPairs = graph.addNewNode('CamPairs',
|
|
||||||
mvsConfig=prepareDenseScene.mvsConfig)
|
|
||||||
depthMap = graph.addNewNode('DepthMap',
|
|
||||||
mvsConfig=camPairs.mvsConfig)
|
|
||||||
depthMapFilter = graph.addNewNode('DepthMapFilter',
|
|
||||||
mvsConfig=depthMap.mvsConfig)
|
|
||||||
meshing = graph.addNewNode('Meshing',
|
|
||||||
mvsConfig=depthMapFilter.mvsConfig)
|
|
||||||
texturing = graph.addNewNode('Texturing',
|
|
||||||
mvsConfig=meshing.mvsConfig)
|
|
||||||
return graph
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Launch the full photogrammetry pipeline.')
|
parser = argparse.ArgumentParser(description='Launch the full photogrammetry pipeline.')
|
||||||
parser.add_argument('--input', metavar='FOLDER', type=str, required=True,
|
parser.add_argument('--input', metavar='FOLDER', type=str, required=True,
|
||||||
help='Input folder or json file.')
|
help='Input folder or json file.')
|
||||||
|
@ -57,7 +26,10 @@ if not args.output and not args.save:
|
||||||
print('Nothing to do. You need to set --output or --save.')
|
print('Nothing to do. You need to set --output or --save.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
graph = photogrammetryPipeline(imageDirectory=args.input)
|
graph = multiview.photogrammetryPipeline()
|
||||||
|
if args.input:
|
||||||
|
cameraInit = graph.findNodeCandidates("CameraInit")
|
||||||
|
cameraInit.imageDirectory.value = args.input
|
||||||
|
|
||||||
if args.save:
|
if args.save:
|
||||||
graph.save(args.save)
|
graph.save(args.save)
|
||||||
|
@ -70,4 +42,3 @@ if args.output:
|
||||||
toNodes = graph.findNodes(args.toNode)
|
toNodes = graph.findNodes(args.toNode)
|
||||||
|
|
||||||
pg.execute(graph, toNodes=toNodes)
|
pg.execute(graph, toNodes=toNodes)
|
||||||
|
|
||||||
|
|
35
meshroom/multiview.py
Normal file
35
meshroom/multiview.py
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
from .core.graph import Graph
|
||||||
|
|
||||||
|
|
||||||
|
def photogrammetryPipeline():
|
||||||
|
# type: () -> Graph
|
||||||
|
graph = Graph('pipeline')
|
||||||
|
|
||||||
|
cameraInit = graph.addNewNode('CameraInit',
|
||||||
|
sensorDatabase=os.environ.get('ALICEVISION_SENSOR_DB', 'sensor_width_camera_database.txt'))
|
||||||
|
|
||||||
|
featureExtraction = graph.addNewNode('FeatureExtraction',
|
||||||
|
input=cameraInit.outputSfm)
|
||||||
|
# TODO: imageMatching
|
||||||
|
featureMatching = graph.addNewNode('FeatureMatching',
|
||||||
|
input=cameraInit.outputSfm,
|
||||||
|
featuresDirectory=featureExtraction.output)
|
||||||
|
structureFromMotion = graph.addNewNode('StructureFromMotion',
|
||||||
|
input=cameraInit.outputSfm,
|
||||||
|
featuresDirectory=featureExtraction.output,
|
||||||
|
matchesDirectory=featureMatching.output)
|
||||||
|
prepareDenseScene = graph.addNewNode('PrepareDenseScene',
|
||||||
|
input=structureFromMotion.output)
|
||||||
|
camPairs = graph.addNewNode('CamPairs',
|
||||||
|
mvsConfig=prepareDenseScene.mvsConfig)
|
||||||
|
depthMap = graph.addNewNode('DepthMap',
|
||||||
|
mvsConfig=camPairs.mvsConfig)
|
||||||
|
depthMapFilter = graph.addNewNode('DepthMapFilter',
|
||||||
|
mvsConfig=depthMap.mvsConfig)
|
||||||
|
meshing = graph.addNewNode('Meshing',
|
||||||
|
mvsConfig=depthMapFilter.mvsConfig)
|
||||||
|
texturing = graph.addNewNode('Texturing',
|
||||||
|
mvsConfig=meshing.mvsConfig)
|
||||||
|
return graph
|
Loading…
Add table
Add a link
Reference in a new issue