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

ERROR with modified cameraInit.sfm #788

Closed
Dave-van-der-Meer opened this issue Feb 15, 2020 · 24 comments
Closed

ERROR with modified cameraInit.sfm #788

Dave-van-der-Meer opened this issue Feb 15, 2020 · 24 comments

Comments

@Dave-van-der-Meer
Copy link

Issue
I need to make a 3D reconstruction of a surface and I use a set of pictures where I know the exact position of the camera for each picture. When I first run the CameraInit node and replace the cameraInit.sfm file with my own sfm file containing the poses of the cameras, Meshroom stops during the ImageMatching node with an error.

Log

The log file says the following.

Program called with the following parameters:
 * featuresFolders =  = [/home/dave/Documents/output_6_meshroom_2/MeshroomCache/FeatureExtraction/0dcd43217828de7078770ade3c03a33f822b1585]
 * input = "/home/dave/Documents/output_6_meshroom_2/MeshroomCache/CameraInit/5ef9ac3fbb6bfae5a288a7d3dfec58599dda3233/cameraInit.sfm"
 * matchingMode = "a/a" (default)
 * maxDescriptors = 500
 * minNbImages = 200
 * nbMatches = 50
 * output = "/home/dave/Documents/output_6_meshroom_2/MeshroomCache/ImageMatching/d2e4b65eb852b5049f7786698a84312f0adee9fc/imageMatches.txt"
 * outputCombinedSfM = "" (default)
 * tree = "/home/dave/Downloads/Meshroom-2019.2.0-linux/Meshroom-2019.2.0/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree"
 * verboseLevel = "info"
 * weights = ""

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::ptree_bad_path> >'
  what():  No such node (poseId)
Aborted (core dumped)

**Desktop (please complete the following and other pertinent information):**
 - OS: [e.g. win 10, osx, ]
 - Python version [e.g. 2.6]
 - Qt/PySide version [e.g. 5.12.4]
 - Meshroom version: please specify if you are using a release version or your own build
   - Binary version (if applicable) [e.g. 2019.1]
   - Commit reference (if applicable) [e.g. 08ddbe2]

Additional context

I use Ubuntu 18.04.

The format how I added the camera poses is as follows, as a list of poses. The rest of the file is simply copied from the original .sfm file.

        {
            "pose": {
                "locked": "0", 
                "transform": {
                    "center": [
                        -3.914926528930664, 
                        0.034545399248600006, 
                        1.3332719802856445
                    ], 
                    "rotation": [
                        0.9062153268215598, 
                        0.39487961818762185, 
                        -0.15114192632071144, 
                        -0.3004690401209693, 
                        0.8006711130692223, 
                        -0.4271085483892653, 
                        -0.04764147201950153, 
                        0.4505506454805451, 
                        0.8914787834894564
                    ]
                }
            }, 
            "poseID": "324815603"
        }, 

I need help to understand how to get this working.

@natowi
Copy link
Member

natowi commented Feb 15, 2020

I do not use this feature, but you can check out the following Issues, they may contain useful information: #399, #740, #453, #475 and #300

@Dave-van-der-Meer
Copy link
Author

Hi natowi,

I already checked those links as I was looking up how to do it and I could not find anything in the issues that could help me.

@Dave-van-der-Meer
Copy link
Author

I did find an interesting pull request:

alicevision/AliceVision#576

How can I use this node?

@natowi
Copy link
Member

natowi commented Feb 15, 2020

IncrementalSfMis accessed by the SfM node, but it is possible this parameter is not yet implemented in the gui.

Maybe "Use only matches from input folder" ?

@Dave-van-der-Meer
Copy link
Author

IncrementalSfMis accessed by the SfM node, but it is possible this parameter is not yet implemented in the gui.

Okay, not in the gui yet. Could you show me how I could run it in the terminal so that I can specify the image folder and the cameraInit.sfm file?

Also, what do you mean with:

Maybe "Use only matches from input folder" ?

@natowi
Copy link
Member

natowi commented Feb 15, 2020

I did not yet try to use the sfm node with a custom sfm file. The exe files in Meshroom-2019.2.0\aliceVision\bin can be run in the cli, also meshroom_compute and meshroom_photogrammetry in the main Mehroom folder. Run without commands in the cli to display the help.

Use only matches from input folder was the only option in the gui that I guessed could be of use.

@Dave-van-der-Meer
Copy link
Author

I already discarted all images which did not have a match.

Here #786 I already asked about how to change the cameras.sfm file in the StructureFromMotion node.

There, it does not take the changes into account and the following node seems to use the .abc file instead of the .sfm file as input. Any ideas how else I could procede?

@natowi
Copy link
Member

natowi commented Feb 18, 2020

I tried using an existing sfm file. Can you try the following with your known camera positions:

  • Compute the default pipeline with a set of images to the SFM node.
  • Open the SFM node folder
    Inspect the cameras.sfm file (you can compare it to the cameraInit.sfm to see what lines need to be added with your known camera positions.)

When creating your own sfm file, set the folders to empty:

"featuresFolders": [
        ""
																			 
    ],
    "matchesFolders": [
        ""
																		   
    ],
  • also set "locked": "0" to "locked": "1"

  • Create a new cameras.sfm file with your known camera data in a new folder somewhere.

  • remove the input connection for the SfM node and paste the path to your new sfm file.

  • in the SfM node settings, activate "Lock Scene Previously reconstructed" and "Force Lock of all Intrinsic camera.."

@natowi
Copy link
Member

natowi commented Feb 18, 2020

Now, if you provide camera positions without 3D points (landmarks), it will triangulate them from features matches. #300 (comment)

@fabiencastan Can you explain the correct usage of a sfm file with known camera positions? I would like to add this to the FAQ

@Dave-van-der-Meer
Copy link
Author

I just tried it again following all your instructions. The SFM node just turns red and does not run.

This is what I get:

Program called with the following parameters:
 * describerTypes = "sift"
 * extraInfoFolder = "/home/dave/Documents/output_6_meshroom_4/MeshroomCache/StructureFromMotion/7942889ce0ba0a155b947607a558d8bb2416bae0"
 * featuresFolders =  = [/home/dave/Documents/output_6_meshroom_4/MeshroomCache/FeatureExtraction/0dcd43217828de7078770ade3c03a33f822b1585]
 * initialPairA = ""
 * initialPairB = ""
 * input = "/home/dave/Documents/output_6_meshroom_4/new_cameras.sfm"
 * interFileExtension = ".abc"
 * localBAGraphDistance = 1
 * localizerEstimator =  Unknown Type "N11aliceVision16robustEstimation16ERobustEstimatorE"
 * localizerEstimatorError = 0
 * localizerEstimatorMaxIterations = 4096
 * lockAllIntrinsics = 1
 * lockScenePreviouslyReconstructed = 1
 * matchesFolders =  = [/home/dave/Documents/output_6_meshroom_4/MeshroomCache/FeatureMatching/af2c63e4680f18e4c470d552de78a329bae2ca33]
 * maxAngleInitialPair = 40
 * maxNumberOfMatches = 0
 * maxReprojectionError = 4
 * minAngleForLandmark = 2
 * minAngleForTriangulation = 3
 * minAngleInitialPair = 5
 * minInputTrackLength = 2
 * minNumberOfObservationsForTriangulation = 2
 * output = "/home/dave/Documents/output_6_meshroom_4/MeshroomCache/StructureFromMotion/7942889ce0ba0a155b947607a558d8bb2416bae0/sfm.abc"
 * outputViewsAndPoses = "/home/dave/Documents/output_6_meshroom_4/MeshroomCache/StructureFromMotion/7942889ce0ba0a155b947607a558d8bb2416bae0/cameras.sfm"
 * useLocalBA = 1
 * useOnlyMatchesFromInputFolder = 0
 * useRigConstraint = 1
 * useTrackFiltering = 1 (default)
 * verboseLevel = "debug"

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::ptree_bad_path> >'
  what():  No such node (poseId)
Aborted (core dumped)

I should mention that Meshroom is only detecting the poses of 5 cameras and I give it all camera poses. Could this cause the error? And why does it complain about 'poseid'?

@natowi
Copy link
Member

natowi commented Feb 19, 2020

Can you provide a sample dataset (images, original poses and your created sfm file) for testing?

With my sample data, using the method described above, the parameters stay close to identical.

(I computed the Camerainit node, openend the folder and replaced the cameraInit.sfm with my sfm file, then computed the other nodes)

@Dave-van-der-Meer
Copy link
Author

Can you provide a sample dataset (images, original poses and your created sfm file) for testing?

Could you please provide me your contact information?

This is what I got. I modified the cameras.sfm file from the SFM node. I can't imagine that there is a lot of difference between the cameraInit and the cameras file.

Screenshot from 2020-02-19 20-08-03

@natowi
Copy link
Member

natowi commented Feb 20, 2020

You can simply send the dataset or download link to the private mailing list alicevision-team@googlegroups.com

I checked your initial code snippet. You mixed up the element order and missed quotation marks.

Your code:

				 {
            "pose": {
                "locked": "0", 
                "transform": {
                    "center": [
                        -3.914926528930664, 
                        0.034545399248600006, 
                        1.3332719802856445
                    ], 
                    "rotation": [
                        0.9062153268215598, 
                        0.39487961818762185, 
                        -0.15114192632071144, 
                        -0.3004690401209693, 
                        0.8006711130692223, 
                        -0.4271085483892653, 
                        -0.04764147201950153, 
                        0.4505506454805451, 
                        0.8914787834894564
                    ]
                }
            }, 
            "poseID": "324815603"
        },

That is causing the error

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::ptree_bad_path> >'
  what():  No such node (poseId)

Fixed code:

{
            "poseId": "324815603",
            "pose": {
                "transform": {
                    "rotation": [
                        "0.9062153268215598",
                        "0.39487961818762185",
                        "-0.15114192632071144",
                        "-0.3004690401209693",
                        "0.8006711130692223",
                        "-0.4271085483892653",
                        "-0.04764147201950153",
                        "0.4505506454805451",
                        "0.8914787834894564"
                    ],
                    "center": [
                        "-3.914926528930664",
                        "0.034545399248600006",
                        "1.3332719802856445"
                    ]
                },
                "locked": "1"
            }
        }

@natowi
Copy link
Member

natowi commented Feb 20, 2020

I checked the files you sent. You need to re-write the entire sfm file. Use a sfm file from a computed SfM node as guide. (About your image dataset: do not capture images too close together, as this does not improve the reconstruction and only increases computation time. Remove images that are out of focus. When using videos, Meshroom can select suitable images for you)

With your fixed sfm file the SfM node should work, but you could also try the StructureFromKnownPoses node (copy the py to the meshroom/libs/meshroom/nodes/aliceVision folder):

wfl

@Dave-van-der-Meer
Copy link
Author

Thanks a lot for your help. I will follow your advice.
Can you just specify which .sfm file you mean (cameras.sfm or cameraInit.sfm)?

Also, I placed the StructureFromKnownPoses.py inside the given folder, but it does not show up inside Meshroom as an option from the list. Do I miss a step?

@natowi
Copy link
Member

natowi commented Feb 20, 2020

Can you just specify which .sfm file you mean (cameras.sfm or cameraInit.sfm)?

Run the graph to the StructureFromMotion node. Open the StructureFromMotion node folder. It contains the cameras.sfm file. Use the file structure to build your own sfm file.

I would recommend you to use a small subset of your images (four or five images), run the graph to the SfM node to get the cameras.sfm file to start with.

Also, I placed the StructureFromKnownPoses.py inside the given folder, but it does not show up inside Meshroom as an option from the list. Do I miss a step?

Restart Meshroom. This node also requires a valid sfm file

@Dave-van-der-Meer
Copy link
Author

Okay, I just followed all the steps: rewriting the sfm file, settings like described.

My remaining issued:

  • The StructureFromMotion node still turns red.
  • I still am not able to get the StructureFromKnownPoses node inside meshroom.

I get a different output log which indicates that I am on the right path. But it does not show a warning.

It indicates: - # cameras calibrated: 0

log.txt

@natowi
Copy link
Member

natowi commented Feb 21, 2020

From what I can read from the log, the triangulation works, but later on all the images are dismissed. Maybe this has something to do with not setting the cameras to calibrated,
so you can try setting "initializationMode": "calibrated"

You can also try the StructureFromKnownPoses node, this node only triangulates the points.

This can also be caused by your dataset (many images taken from the same point or with marginal differences, unsharp images, unconnected images). With the default parameters, only 5 of 50 cameras are reconstructed. You could try to get better results by setting the quality to High or ultra and add AKAZE, but my recommendation is to use a dataset that reconstructs all cameras with the default pipeline.

@Dave-van-der-Meer
Copy link
Author

I have set the "initializationMode": "calibrated", I took another dataset and set the quality to "high" and I added "AKAZE". For the rest I used the standard pipeline except that I used my modified cameraInit.txt containing the known poses of the cameras.

The SFM node still turns red. I still can't figure out what it the problem. Also, I can't figure out how to use the StructureFromKnownPoses node. It does not show up in the list of nodes, even though I added it to the directory as you explained.

Here is the log file of my latest run:

log.txt

It just says: The local bundle adjustment refinement has not been done: the new cameras are not connected to the rest of the graph. Does this mean that my images are not good enough?

@natowi
Copy link
Member

natowi commented Feb 28, 2020

Does this mean that my images are not good enough?

Likely yes. As I wrote before, "With the default parameters, only 5 of 50 cameras are reconstructed". This is really bad "(many images taken from the same point or with marginal differences, unsharp images, unconnected images)". When you have a bad or difficult dataset and try something new as imposing known camera positions, it is difficult to pinpoint the origin of an error.

So create a new dataset that has a 70% image overlap, in focus, taken from different positions and covering the area of interest. Now all your cameras should be reconstructed using the default graph. Then you can try a new project with your known camera positions with this dataset.

@Dave-van-der-Meer
Copy link
Author

Okay. I think I get it. One last time, I want to ask for confirmation about this log messages. It also indicates that I need better images, right? If yes, then I start to understand the software.

Could you please have a look? Also, I thank you very much for your support so far.

0.log

@natowi
Copy link
Member

natowi commented Feb 28, 2020

Yes, there are not enough points reconstructed from the ~ five cameras.

@Dave-van-der-Meer
Copy link
Author

Okay, I understand. It ust surprises me that Meshroom can produce a reasonable 3D Mesh when I don't impose the camera poses.

Thanks a lot for your help.

@natowi
Copy link
Member

natowi commented Feb 28, 2020

I think this will change once this feature will be officially introduced.

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