Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] How to set default camera position to the position where camera was used to capture the first image? #930

Closed
xzhub opened this issue Jun 5, 2020 · 17 comments

Comments

@xzhub
Copy link

xzhub commented Jun 5, 2020

Describe the problem
I am using meshroom command line pipeline to build 3d model from a folder of images. Just like this(all default parameters):

meshroom_photogrammetry --input input_folder/ --output output_folder/

The model is good, but the default view point is always wired, I have to drag my mouse a long time to find a good view position.

I'd like to know if there is a way, to tell mushroom use the first image's camera position as the default camera position in the output 3d model file?

Desktop (please complete the following and other pertinent information):

  • OS: centos 7
  • Meshroom version: please specify if you are using a release version or your own build
    • Binary version (if applicable) [e.g. 2019.2]
@natowi
Copy link
Member

natowi commented Jun 6, 2020

You can use the SfMTransform and select FromSingleCamera to use the orientation from one camera as origin, including orientation. You need to specify the filename for the image.

You can use a graph.mg file (--save) for the new computation graph (--pipeline) https://github.com/alicevision/AliceVision/wiki/CLI-Parameters #683 (comment)

@xzhub
Copy link
Author

xzhub commented Jun 11, 2020

Thanks for the answer, so happy to know that the solution could be super straight forward!

After reading the document, I believe this is an option for the latest 2020 version only, am I right? Can I use it with version 2019.2? https://meshroom-manual.readthedocs.io/en/latest/node-reference/nodes/SfMTransform.html

Is there anywhere I can download a preview version of the binary file of v2020? I guess I should just try the develop branch, right?

@natowi
Copy link
Member

natowi commented Jun 11, 2020

In the Meshroom (2019.2) folder there is a file named meshroom_photogrammetry that can be run from the cli. It has the following options:

                                   [-h] 
                                   [--input FOLDER_OR_SFM]
                                   [--inputImages [IMAGES [IMAGES ...]]]
                                   [--pipeline MESHROOM_FILE]
                                   [--overrides SETTINGS]
                                   [--output FOLDER]
                                   [--cache FOLDER]
                                   [--save FILE]
                                   [--scale {-1,1,2,4,8,16}]
                                   [--toNode [NODE [NODE ...]]]
                                   [--forceStatus]
                                   [--forceCompute]

@xzhub
Copy link
Author

xzhub commented Jun 11, 2020

I got the saved file from meshroom v2019.2, however, there is no such section of SfMTransform, and if I check the 2019.2 version of user guide, there is no such description yet. (It's in the latest document)

Here is an example of the saved file of mushroom v2019.2. Did I miss something?

{
    "header": {
        "pipelineVersion": "2.2",
        "releaseVersion": "2019.2.0",
        "fileVersion": "1.1",
        "nodesVersions": {
            "MeshFiltering": "2.0",
            "PrepareDenseScene": "3.0",
            "ImageMatching": "1.0",
            "CameraInit": "2.0",
            "Publish": "1.1",
            "Texturing": "5.0",
            "FeatureExtraction": "1.1",
            "StructureFromMotion": "2.0",
            "DepthMap": "2.0",
            "Meshing": "3.0",
            "FeatureMatching": "2.0",
            "DepthMapFilter": "3.0"
        }
    },
    "graph": {
        "CameraInit_1": {
            "nodeType": "CameraInit",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "2b3beecae6929077fe87db44e9ec81fddd857a5e"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "viewpoints": [
                    {
                        "viewId": 1269914993,
                        "poseId": 1269914993,
                        "path": "20200611031915-b2017827-d62c-40a9-a547-a298c9c864b0_img/1efe9ce8-2a48-4d26-b44c-2bfcda734ba3.JPG",
                        "intrinsicId": 3294762099,
                        "rigId": -1,
                        "subPoseId": -1,
                        "metadata": "{\"AliceVision:SensorWidth\": \"4.890000\", \"DateTime\": \"2019:01:21 12:34:43\", \"Exif:ApertureValue\": \"1.69599\", \"Exif:BrightnessValue\": \"11.1489\", \"Exif:ColorSpace\": \"65535\", \"Exif:DateTimeDigitized\": \"2019:01:21 12:34:43\", \"Exif:DateTimeOriginal\": \"2019:01:21 12:34:43\", \"Exif:ExifVersion\": \"0221\", \"Exif:ExposureBiasValue\": \"0\", \"Exif:ExposureMode\": \"0\", \"Exif:ExposureProgram\": \"2\", \"Exif:Flash\": \"16\", \"Exif:FlashPixVersion\": \"0100\", \"Exif:FocalLength\": \"4\", \"Exif:FocalLengthIn35mmFilm\": \"28\", \"Exif:LensMake\": \"Apple\", \"Exif:LensModel\": \"iPhone X back dual camera 4mm f/1.8\", \"Exif:LensSpecification\": \"4, 6, 1.8, 2.4\", \"Exif:MeteringMode\": \"5\", \"Exif:PhotographicSensitivity\": \"20\", \"Exif:PixelXDimension\": \"4032\", \"Exif:PixelYDimension\": \"3024\", \"Exif:SceneCaptureType\": \"0\", \"Exif:SensingMethod\": \"2\", \"Exif:ShutterSpeedValue\": \"11.5522\", \"Exif:SubsecTimeDigitized\": \"187\", \"Exif:SubsecTimeOriginal\": \"187\", \"Exif:WhiteBalance\": \"0\", \"Exif:YCbCrPositioning\": \"1\", \"ExposureTime\": \"0.000333\", \"FNumber\": \"1.8\", \"GPS:Altitude\": \"52.3303\", \"GPS:AltitudeRef\": \"0\", \"GPS:DateStamp\": \"2019:01:21\", \"GPS:DestBearing\": \"60.2922\", \"GPS:DestBearingRef\": \"T\", \"GPS:HPositioningError\": \"5\", \"GPS:ImgDirection\": \"60.2922\", \"GPS:ImgDirectionRef\": \"T\", \"GPS:Latitude\": \"33, 7, 41.41\", \"GPS:LatitudeRef\": \"N\", \"GPS:Longitude\": \"117, 18, 43.08\", \"GPS:LongitudeRef\": \"W\", \"GPS:Speed\": \"0.49\", \"GPS:SpeedRef\": \"K\", \"GPS:TimeStamp\": \"20, 34, 42.04\", \"ICCProfile\": \"0, 0, 2, 36, 97, 112, 112, 108, 4, 0, 0, 0, 109, 110, 116, 114, 82, 71, 66, 32, 88, 89, 90, 32, 7, 225, 0, 7, 0, 7, 0, 13, 0, 22, 0, 32, 97, 99, 115, 112, 65, 80, 80, 76, 0, 0, 0, 0, 65, 80, 80, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... [548 x uint8]\", \"Make\": \"Apple\", \"Model\": \"iPhone X\", \"Orientation\": \"1\", \"ResolutionUnit\": \"none\", \"Software\": \"12.1.2\", \"XResolution\": \"72\", \"YResolution\": \"72\", \"apple-fi:AngleInfoRoll\": \"0\", \"apple-fi:AngleInfoYaw\": \"315\", \"apple-fi:ConfidenceLevel\": \"99\", \"apple-fi:FaceID\": \"2\", \"apple-fi:Timestamp\": \"8896170324899\", \"jpeg:subsampling\": \"4:2:0\", \"mwg-rs:Type\": \"Face\", \"oiio:ColorSpace\": \"sRGB\", \"rdf:parseType\": \"Resource\", \"stArea:h\": \"0.16299999999999998\", \"stArea:unit\": \"normalized\", \"stArea:w\": \"0.122\", \"stArea:x\": \"0.53600000000000003\", \"stArea:y\": \"0.41249999999999998\", \"stDim:h\": \"3024\", \"stDim:unit\": \"pixel\", \"stDim:w\": \"4032\"}"
                    },
                    {
                        "viewId": 1610555793,
                        "poseId": 1610555793,
                        "path": "20200611031915-b2017827-d62c-40a9-a547-a298c9c864b0_img/00bbdbb9-6957-41a3-8827-2c36e87963e0.JPG",
                        "intrinsicId": 3294762099,
                        "rigId": -1,
                        "subPoseId": -1,
                        "metadata": "{\"AliceVision:SensorWidth\": \"4.890000\", \"DateTime\": \"2019:01:21 12:34:45\", \"Exif:ApertureValue\": \"1.69599\", \"Exif:BrightnessValue\": \"11.3963\", \"Exif:ColorSpace\": \"65535\", \"Exif:DateTimeDigitized\": \"2019:01:21 12:34:45\", \"Exif:DateTimeOriginal\": \"2019:01:21 12:34:45\", \"Exif:ExifVersion\": \"0221\", \"Exif:ExposureBiasValue\": \"0\", \"Exif:ExposureMode\": \"0\", \"Exif:ExposureProgram\": \"2\", \"Exif:Flash\": \"16\", \"Exif:FlashPixVersion\": \"0100\", \"Exif:FocalLength\": \"4\", \"Exif:FocalLengthIn35mmFilm\": \"28\", \"Exif:LensMake\": \"Apple\", \"Exif:LensModel\": \"iPhone X back dual camera 4mm f/1.8\", \"Exif:LensSpecification\": \"4, 6, 1.8, 2.4\", \"Exif:MeteringMode\": \"5\", \"Exif:PhotographicSensitivity\": \"20\", \"Exif:PixelXDimension\": \"4032\", \"Exif:PixelYDimension\": \"3024\", \"Exif:SceneCaptureType\": \"0\", \"Exif:SensingMethod\": \"2\", \"Exif:ShutterSpeedValue\": \"11.8494\", \"Exif:SubsecTimeDigitized\": \"985\", \"Exif:SubsecTimeOriginal\": \"985\", \"Exif:WhiteBalance\": \"0\", \"Exif:YCbCrPositioning\": \"1\", \"ExposureTime\": \"0.000271003\", \"FNumber\": \"1.8\", \"GPS:Altitude\": \"51.1845\", \"GPS:AltitudeRef\": \"0\", \"GPS:DateStamp\": \"2019:01:21\", \"GPS:DestBearing\": \"61.3194\", \"GPS:DestBearingRef\": \"T\", \"GPS:HPositioningError\": \"5\", \"GPS:ImgDirection\": \"61.3194\", \"GPS:ImgDirectionRef\": \"T\", \"GPS:Latitude\": \"33, 7, 41.38\", \"GPS:LatitudeRef\": \"N\", \"GPS:Longitude\": \"117, 18, 42.99\", \"GPS:LongitudeRef\": \"W\", \"GPS:Speed\": \"0.19\", \"GPS:SpeedRef\": \"K\", \"GPS:TimeStamp\": \"20, 34, 45.05\", \"ICCProfile\": \"0, 0, 2, 36, 97, 112, 112, 108, 4, 0, 0, 0, 109, 110, 116, 114, 82, 71, 66, 32, 88, 89, 90, 32, 7, 225, 0, 7, 0, 7, 0, 13, 0, 22, 0, 32, 97, 99, 115, 112, 65, 80, 80, 76, 0, 0, 0, 0, 65, 80, 80, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... [548 x uint8]\", \"Make\": \"Apple\", \"Model\": \"iPhone X\", \"Orientation\": \"1\", \"ResolutionUnit\": \"none\", \"Software\": \"12.1.2\", \"XResolution\": \"72\", \"YResolution\": \"72\", \"apple-fi:AngleInfoRoll\": \"0\", \"apple-fi:AngleInfoYaw\": \"0\", \"apple-fi:ConfidenceLevel\": \"364\", \"apple-fi:FaceID\": \"2\", \"apple-fi:Timestamp\": \"8896237509774\", \"jpeg:subsampling\": \"4:2:0\", \"mwg-rs:Type\": \"Face\", \"oiio:ColorSpace\": \"sRGB\", \"rdf:parseType\": \"Resource\", \"stArea:h\": \"0.17499999999999999\", \"stArea:unit\": \"normalized\", \"stArea:w\": \"0.13100000000000001\", \"stArea:x\": \"0.44450000000000001\", \"stArea:y\": \"0.40349999999999997\", \"stDim:h\": \"3024\", \"stDim:unit\": \"pixel\", \"stDim:w\": \"4032\"}"
                    },
                    {
                        "viewId": 2064852012,
                        "poseId": 2064852012,
                        "path": "20200611031915-b2017827-d62c-40a9-a547-a298c9c864b0_img/e80d70c0-0a50-4534-a159-06d16320e8d9.JPG",
                        "intrinsicId": 3294762099,
                        "rigId": -1,
                        "subPoseId": -1,
                        "metadata": "{\"AliceVision:SensorWidth\": \"4.890000\", \"DateTime\": \"2019:01:21 12:34:44\", \"Exif:ApertureValue\": \"1.69599\", \"Exif:BrightnessValue\": \"11.3021\", \"Exif:ColorSpace\": \"65535\", \"Exif:DateTimeDigitized\": \"2019:01:21 12:34:44\", \"Exif:DateTimeOriginal\": \"2019:01:21 12:34:44\", \"Exif:ExifVersion\": \"0221\", \"Exif:ExposureBiasValue\": \"0\", \"Exif:ExposureMode\": \"0\", \"Exif:ExposureProgram\": \"2\", \"Exif:Flash\": \"16\", \"Exif:FlashPixVersion\": \"0100\", \"Exif:FocalLength\": \"4\", \"Exif:FocalLengthIn35mmFilm\": \"28\", \"Exif:LensMake\": \"Apple\", \"Exif:LensModel\": \"iPhone X back dual camera 4mm f/1.8\", \"Exif:LensSpecification\": \"4, 6, 1.8, 2.4\", \"Exif:MeteringMode\": \"5\", \"Exif:PhotographicSensitivity\": \"25\", \"Exif:PixelXDimension\": \"4032\", \"Exif:PixelYDimension\": \"3024\", \"Exif:SceneCaptureType\": \"0\", \"Exif:SensingMethod\": \"2\", \"Exif:ShutterSpeedValue\": \"11.7467\", \"Exif:SubsecTimeDigitized\": \"666\", \"Exif:SubsecTimeOriginal\": \"666\", \"Exif:WhiteBalance\": \"0\", \"Exif:YCbCrPositioning\": \"1\", \"ExposureTime\": \"0.000291036\", \"FNumber\": \"1.8\", \"GPS:Altitude\": \"51.9253\", \"GPS:AltitudeRef\": \"0\", \"GPS:DateStamp\": \"2019:01:21\", \"GPS:DestBearing\": \"63.8505\", \"GPS:DestBearingRef\": \"T\", \"GPS:HPositioningError\": \"5\", \"GPS:ImgDirection\": \"63.8505\", \"GPS:ImgDirectionRef\": \"T\", \"GPS:Latitude\": \"33, 7, 41.4\", \"GPS:LatitudeRef\": \"N\", \"GPS:Longitude\": \"117, 18, 42.99\", \"GPS:LongitudeRef\": \"W\", \"GPS:Speed\": \"0.49\", \"GPS:SpeedRef\": \"K\", \"GPS:TimeStamp\": \"20, 34, 44.04\", \"ICCProfile\": \"0, 0, 2, 36, 97, 112, 112, 108, 4, 0, 0, 0, 109, 110, 116, 114, 82, 71, 66, 32, 88, 89, 90, 32, 7, 225, 0, 7, 0, 7, 0, 13, 0, 22, 0, 32, 97, 99, 115, 112, 65, 80, 80, 76, 0, 0, 0, 0, 65, 80, 80, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... [548 x uint8]\", \"Make\": \"Apple\", \"Model\": \"iPhone X\", \"Orientation\": \"1\", \"ResolutionUnit\": \"none\", \"Software\": \"12.1.2\", \"XResolution\": \"72\", \"YResolution\": \"72\", \"apple-fi:AngleInfoRoll\": \"0\", \"apple-fi:AngleInfoYaw\": \"0\", \"apple-fi:ConfidenceLevel\": \"466\", \"apple-fi:FaceID\": \"2\", \"apple-fi:Timestamp\": \"8896206316794\", \"jpeg:subsampling\": \"4:2:0\", \"mwg-rs:Type\": \"Face\", \"oiio:ColorSpace\": \"sRGB\", \"rdf:parseType\": \"Resource\", \"stArea:h\": \"0.17499999999999999\", \"stArea:unit\": \"normalized\", \"stArea:w\": \"0.13100000000000006\", \"stArea:x\": \"0.48650000000000004\", \"stArea:y\": \"0.41249999999999998\", \"stDim:h\": \"3024\", \"stDim:unit\": \"pixel\", \"stDim:w\": \"4032\"}"
                    }
                ],
                "intrinsics": [
                    {
                        "intrinsicId": 3294762099,
                        "pxInitialFocalLength": 3298.159509202454,
                        "pxFocalLength": 3298.159509202454,
                        "type": "radial3",
                        "width": 4032,
                        "height": 3024,
                        "serialNumber": "20200611031915-b2017827-d62c-40a9-a547-a298c9c864b0_img_Apple_iPhone X",
                        "principalPoint": {
                            "x": 2016.0,
                            "y": 1512.0
                        },
                        "initializationMode": "estimated",
                        "distortionParams": [
                            0.0,
                            0.0,
                            0.0
                        ],
                        "locked": false
                    }
                ],
                "sensorDatabase": "/tmp/bin/Meshroom-2019.2.0/aliceVision/share/aliceVision/cameraSensors.db",
                "defaultFieldOfView": 45.0,
                "groupCameraFallback": "folder",
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/cameraInit.sfm"
            }
        },
        "FeatureExtraction_1": {
            "nodeType": "FeatureExtraction",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 40,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "a06a47b90d331ca271a9780fa004a00dec3a2981"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{CameraInit_1.output}",
                "describerTypes": [
                    "sift"
                ],
                "describerPreset": "normal",
                "forceCpuExtraction": true,
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/"
            }
        },
        "ImageMatching_1": {
            "nodeType": "ImageMatching",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "e25a5d115b41b46601bb7bb259e8fb1236cb2d5d"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{FeatureExtraction_1.input}",
                "featuresFolders": [
                    "{FeatureExtraction_1.output}"
                ],
                "tree": "/tmp/bin/Meshroom-2019.2.0/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree",
                "weights": "",
                "minNbImages": 200,
                "maxDescriptors": 500,
                "nbMatches": 50,
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/imageMatches.txt"
            }
        },
        "FeatureMatching_1": {
            "nodeType": "FeatureMatching",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 20,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "5b119b8d74c864b46ef54e44b08d21eaed557c97"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{ImageMatching_1.input}",
                "featuresFolders": "{ImageMatching_1.featuresFolders}",
                "imagePairsList": "{ImageMatching_1.output}",
                "describerTypes": [
                    "sift"
                ],
                "photometricMatchingMethod": "ANN_L2",
                "geometricEstimator": "acransac",
                "geometricFilterType": "fundamental_matrix",
                "distanceRatio": 0.8,
                "maxIteration": 2048,
                "geometricError": 0.0,
                "maxMatches": 0,
                "savePutativeMatches": false,
                "guidedMatching": false,
                "exportDebugFiles": false,
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/"
            }
        },
        "StructureFromMotion_1": {
            "nodeType": "StructureFromMotion",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "167b132b1aed55edccbd6ffef3428c13a1340a4b"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{FeatureMatching_1.input}",
                "featuresFolders": "{FeatureMatching_1.featuresFolders}",
                "matchesFolders": [
                    "{FeatureMatching_1.output}"
                ],
                "describerTypes": [
                    "sift"
                ],
                "localizerEstimator": "acransac",
                "localizerEstimatorMaxIterations": 4096,
                "localizerEstimatorError": 0.0,
                "lockScenePreviouslyReconstructed": false,
                "useLocalBA": true,
                "localBAGraphDistance": 1,
                "maxNumberOfMatches": 0,
                "minInputTrackLength": 2,
                "minNumberOfObservationsForTriangulation": 2,
                "minAngleForTriangulation": 3.0,
                "minAngleForLandmark": 2.0,
                "maxReprojectionError": 4.0,
                "minAngleInitialPair": 5.0,
                "maxAngleInitialPair": 40.0,
                "useOnlyMatchesFromInputFolder": false,
                "useRigConstraint": true,
                "lockAllIntrinsics": false,
                "initialPairA": "",
                "initialPairB": "",
                "interFileExtension": ".abc",
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/sfm.abc",
                "outputViewsAndPoses": "{cache}/{nodeType}/{uid0}/cameras.sfm",
                "extraInfoFolder": "{cache}/{nodeType}/{uid0}/"
            }
        },
        "PrepareDenseScene_1": {
            "nodeType": "PrepareDenseScene",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 40,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "77223adfe46751bf3f542f0eb7891fcdd4f195ea"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{StructureFromMotion_1.output}",
                "imagesFolders": [],
                "outputFileType": "exr",
                "saveMetadata": true,
                "saveMatricesTxtFiles": false,
                "evCorrection": false,
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/",
                "outputUndistorted": "{cache}/{nodeType}/{uid0}/*.{outputFileTypeValue}"
            }
        },
        "DepthMap_1": {
            "nodeType": "DepthMap",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 3,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "c049f30b2ef912a10acbd2cfb7d4262c70490e5c"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{PrepareDenseScene_1.input}",
                "imagesFolder": "{PrepareDenseScene_1.output}",
                "downscale": 2,
                "minViewAngle": 2.0,
                "maxViewAngle": 70.0,
                "sgmMaxTCams": 10,
                "sgmWSH": 4,
                "sgmGammaC": 5.5,
                "sgmGammaP": 8.0,
                "refineMaxTCams": 6,
                "refineNSamplesHalf": 150,
                "refineNDepthsToRefine": 31,
                "refineNiters": 100,
                "refineWSH": 3,
                "refineSigma": 15,
                "refineGammaC": 15.5,
                "refineGammaP": 8.0,
                "refineUseTcOrRcPixSize": false,
                "exportIntermediateResults": false,
                "nbGPUs": 0,
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/"
            }
        },
        "DepthMapFilter_1": {
            "nodeType": "DepthMapFilter",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 10,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "1ba983caa6a4afa97c84a3d5b651e02828e0182c"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{DepthMap_1.input}",
                "depthMapsFolder": "{DepthMap_1.output}",
                "minViewAngle": 2.0,
                "maxViewAngle": 70.0,
                "nNearestCams": 10,
                "minNumOfConsistentCams": 3,
                "minNumOfConsistentCamsWithLowSimilarity": 4,
                "pixSizeBall": 0,
                "pixSizeBallWithLowSimilarity": 0,
                "computeNormalMaps": false,
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/"
            }
        },
        "Meshing_1": {
            "nodeType": "Meshing",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 1,
                "split": 1
            },
            "uids": {
                "0": "344cd24579316c95822cbbbd5fdf6cbf665eb84a"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{DepthMapFilter_1.input}",
                "depthMapsFolder": "{DepthMapFilter_1.depthMapsFolder}",
                "depthMapsFilterFolder": "{DepthMapFilter_1.output}",
                "estimateSpaceFromSfM": true,
                "estimateSpaceMinObservations": 3,
                "estimateSpaceMinObservationAngle": 10,
                "maxInputPoints": 50000000,
                "maxPoints": 5000000,
                "maxPointsPerVoxel": 1000000,
                "minStep": 2,
                "partitioning": "singleBlock",
                "repartition": "multiResolution",
                "angleFactor": 15.0,
                "simFactor": 15.0,
                "pixSizeMarginInitCoef": 2.0,
                "pixSizeMarginFinalCoef": 4.0,
                "voteMarginFactor": 4.0,
                "contributeMarginFactor": 2.0,
                "simGaussianSizeInit": 10.0,
                "simGaussianSize": 10.0,
                "minAngleThreshold": 1.0,
                "refineFuse": true,
                "addLandmarksToTheDensePointCloud": false,
                "colorizeOutput": false,
                "saveRawDensePointCloud": false,
                "verboseLevel": "info"
            },
            "outputs": {
                "outputMesh": "{cache}/{nodeType}/{uid0}/mesh.obj",
                "output": "{cache}/{nodeType}/{uid0}/densePointCloud.abc"
            }
        },
        "MeshFiltering_1": {
            "nodeType": "MeshFiltering",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 1,
                "split": 1
            },
            "uids": {
                "0": "c4380decd9dbe8090afbfb1f8150c43b403a7c4f"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "inputMesh": "{Meshing_1.outputMesh}",
                "removeLargeTrianglesFactor": 60.0,
                "keepLargestMeshOnly": false,
                "iterations": 5,
                "lambda": 1.0,
                "verboseLevel": "info"
            },
            "outputs": {
                "outputMesh": "{cache}/{nodeType}/{uid0}/mesh.obj"
            }
        },
        "Texturing_1": {
            "nodeType": "Texturing",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 1,
                "split": 1
            },
            "uids": {
                "0": "e572dee556509780ff07f071d03785af82bdfd56"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{Meshing_1.output}",
                "imagesFolder": "{DepthMap_1.imagesFolder}",
                "inputMesh": "{MeshFiltering_1.outputMesh}",
                "textureSide": 8192,
                "downscale": 1,
                "outputTextureFileType": "png",
                "unwrapMethod": "Basic",
                "useUDIM": true,
                "fillHoles": false,
                "padding": 5,
                "correctEV": false,
                "useScore": true,
                "processColorspace": "sRGB",
                "multiBandDownscale": 4,
                "multiBandNbContrib": {
                    "high": 1,
                    "midHigh": 5,
                    "midLow": 10,
                    "low": 0
                },
                "bestScoreThreshold": 0.1,
                "angleHardThreshold": 90.0,
                "forceVisibleByAllVertices": false,
                "flipNormals": false,
                "visibilityRemappingMethod": "PullPush",
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/",
                "outputMesh": "{cache}/{nodeType}/{uid0}/texturedMesh.obj",
                "outputMaterial": "{cache}/{nodeType}/{uid0}/texturedMesh.mtl",
                "outputTextures": "{cache}/{nodeType}/{uid0}/texture_*.{outputTextureFileTypeValue}"
            }
        },
        "Publish_1": {
            "nodeType": "Publish",
            "position": [
                0,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "97efdbfe884727c601f7a38f31ccf9d2cfa113c9"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "inputFiles": [
                    "{Texturing_1.outputMesh}",
                    "{Texturing_1.outputMaterial}",
                    "{Texturing_1.outputTextures}"
                ],
                "output": "output"
            },
            "outputs": {}
        }
    }
}

@natowi
Copy link
Member

natowi commented Jun 11, 2020

When opening the Meshroom GUI, you need to add SfM transform to the graph (place it between StructureFromMotion node and PrepareDenseScene node). It is not included in the default graph.

@xzhub
Copy link
Author

xzhub commented Jun 12, 2020

I managed to generate the graph file with SfM transform, and try to insert a similar section for the command line version. It's something like:

meshroom_photogrammetry --input IMG \
    --output OUT --save meshfile_old.txt

python modify.py  meshfile_old.txt meshfile_new.txt

meshroom_photogrammetry --input IMG \
    --output OUT --save meshfile_old.txt --pipeline meshfile_new.txt

However, I am getting error:

Traceback (most recent call last):
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "/opt/Meshroom/setupInitScriptUnix.py", line 39, in run
  File "bin/meshroom_photogrammetry", line 90, in <module>
  File "/opt/Meshroom/meshroom/core/graph.py", line 1080, in loadGraph
  File "/opt/Meshroom/meshroom/common/core.py", line 122, in func_wrapper
  File "/opt/Meshroom/meshroom/core/graph.py", line 262, in load
KeyError: 'nodeType'
Plugins loaded:  CameraCalibration, CameraInit, CameraLocalization, CameraRigCalibration, CameraRigLocalization, ConvertSfMFormat, DepthMap, DepthMapFilter, ExportAnimatedCamera, ExportColoredPointCloud, ExportMaya, FeatureExtraction, FeatureMatching, ImageMatching, ImageMatchingMultiSfM, KeyframeSelection, LDRToHDR, MeshDecimate, MeshDenoising, MeshFiltering, MeshResampling, Meshing, PrepareDenseScene, Publish, SfMAlignment, SfMTransform, StructureFromMotion, Texturing
0.14user 0.02system 0:00.17elapsed 99%CPU (0avgtext+0avgdata 19424maxresident)k
0inputs+16outputs (0major+5709minor)pagefaults 0swaps

Is there anything wrong with this file? could you please take a look? Thanks very much! the pipeline file meshfile_old.txt meshfile_new.txt are attached.
meshfile_old.txt
meshfile_new.txt

@natowi natowi added the linux label Jun 12, 2020
@natowi
Copy link
Member

natowi commented Jun 12, 2020

Create the new graph (without images) in the Meshroom gui and save it.
Then edit the sfm file and replace absolute paths with relative paths.

Use --paramOverrides NODE.param=value to override specific settings and for setting the image to be used in the sfmtransformation node

https://github.com/alicevision/AliceVision/wiki/CLI-Parameters

sfmtransfdef.mg.txt

@xzhub
Copy link
Author

xzhub commented Jun 12, 2020

I found the issue in the meshfile_new.txt, turns out that there was a bug in my code inserting the sfm section. The inserted sfm was nested inside another sfm section!

Here is the wrong one:

"SfMTransform_1": {
            "SfMTransform_1": {
                "nodeType": "SfMTransform",
                "position": [
                    775,
                    0
                ],
                "parallelization": {
                    "blockSize": 0,
                    "size": 3,
                    "split": 1
                },
                "uids": {
                    "0": "cf53d44c3a8f8cfb4b119e3289bbce7d2fee7ee8"
                },
                "internalFolder": "{cache}/{nodeType}/{uid0}/",
                "inputs": {
                    "input": "{StructureFromMotion_1.output}",
                    "method": "from_single_camera",
                    "transformation": "d72dd0c2-ca8d-4ce9-b9d9-26f9e5f22cac.JPG",
                    "landmarksDescriberTypes": [
                        "sift",
                        "akaze"
                    ],
                    "scale": 10.0,
                    "verboseLevel": "info"
                },
                "outputs": {
                    "output": "{cache}/{nodeType}/{uid0}/transformedSfM.abc"
                }
            }
}

And this is the correct one:

      "SfMTransform_1": {
            "nodeType": "SfMTransform",
            "position": [
                775,
                0
            ],
            "parallelization": {
                "blockSize": 0,
                "size": 3,
                "split": 1
            },
            "uids": {
                "0": "cf53d44c3a8f8cfb4b119e3289bbce7d2fee7ee8"
            },
            "internalFolder": "{cache}/{nodeType}/{uid0}/",
            "inputs": {
                "input": "{StructureFromMotion_1.output}",
                "method": "from_single_camera",
                "transformation": "96465562-9540-4692-a623-c38350e7f30c.JPG",
                "landmarksDescriberTypes": [
                    "sift",
                    "akaze"
                ],
                "scale": 10.0,
                "verboseLevel": "info"
            },
            "outputs": {
                "output": "{cache}/{nodeType}/{uid0}/transformedSfM.abc"
            }
        }

Compare the 3d model generated by the new method(left) and the default pipeline(right), the result is much satisfying. Thank you natowi for the help!
image

@xzhub xzhub closed this as completed Jun 12, 2020
@xzhub xzhub reopened this Jun 17, 2020
@xzhub
Copy link
Author

xzhub commented Jun 17, 2020

Hi natowi,
I'd like to reopen this question, because the current model's origin is still not ideal...
I am wondering if meshroom can set the origin to the Mass(or Geometry) center of the model? And ideally the default view point should be consistent with the camera, not upside down (see the above picture, the left side one is better).

Currently we have resolved the second issue, after using the first image's camera as the origin, the model is not upside down anymore, but when I rotate it, it is circling around the camera, while what I'd like to see is that it can circle around itself.

@natowi
Copy link
Member

natowi commented Jun 17, 2020

I am wondering if meshroom can set the origin to the Mass(or Geometry) centre of the model?

Short answer: no. At the moment we don´t have tools in the 3d viewer that would allow modifying the model (selecting area, bounding box, centre point, origin, size, selection removal,...), this needs to be done in Meshlab for now.

@xzhub
Copy link
Author

xzhub commented Jun 17, 2020

I see... I'll explore some other command line tools to do this work. UI version software is not very convenient for large amount of model files. Please let me know if you have any recommendations.

Last, I'd like to know if SfMTransform could be added in the latter position of the graph? So that I can change it and re-run the analysis without redoing too much calculations. (most of the time I will change 'scale':1.0 and "method": "from_single_camera")

@natowi
Copy link
Member

natowi commented Jun 18, 2020

SfMTransform can only be used with sfm files. To avoid recomputing the DepthMap node, you can add the node like this:

img44

@xzhub
Copy link
Author

xzhub commented Jun 18, 2020

Thank you natowi! Could you please attach the exported graph file for me? There are some lines covered by the node block so I can't really see the connections.

@natowi
Copy link
Member

natowi commented Jun 18, 2020

Remove the connection from DepthMapFilter Input and insert the SfMTransform node.
From DepthMap Input -> Input SfMTransform Output-> DepthMapFilter

@natowi natowi closed this as completed Jun 21, 2020
@xzhub
Copy link
Author

xzhub commented Jun 23, 2020

Look at the screenshot you shared, the SfMTransform is named SfMTransform2. Does this mean there is another SfMTransform(SfMTransform1) in between StructureFromMotion node and PrepareDenseScene?

@natowi
Copy link
Member

natowi commented Jun 23, 2020

No, I was just testing a few things in the same graph.

@xzhub
Copy link
Author

xzhub commented Apr 7, 2021

When opening the Meshroom GUI, you need to add SfM transform to the graph (place it between StructureFromMotion node and PrepareDenseScene node). It is not included in the default graph.

Is this still the correct usage in 2021 version Meshroom, that place SfMTransform in between StructureFromMotion node and PrepareDenseScene node? I think this SfMTransform is not working properly now. The new version SfMtransform has different output files:

   "outputs": {
            "output": "{cache}/{nodeType}/{uid0}/sfm.abc",
            "outputViewsAndPoses": "{cache}/{nodeType}/{uid0}/cameras.sfm"
        }

comparing to the v2019:

  "outputs": {
            "output": "{cache}/{nodeType}/{uid0}/transformedSfM.abc"
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants