-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New Executable for Control Point Registration on the Command Line #1239
base: develop
Are you sure you want to change the base?
Conversation
Great! Some month ago I was thinking about adding a binary to detect marker (abstract detection) to create landmark image observation. So then the user would have Your script is nicely going in this way and I'm very happy to see that you can use the full flexibility of OpenMVG json scene file there! Notes:
My long term plan was to move this prototype code to a sfm_data registration module but I did not found the time to make it yet. We can think also to add an example with a tiny dataset. It would be really useful for the community. |
Yes, I am using the upper-left corner in this example, but that's totally arbitrary. The Aruco library in opencv returns all 4 corners, so it would be trivial to use the center. I do have a 4 image set with the Aruco markers, which works well with the above python test code. But these are not high quality images in any way. It's just a set of 4 grayscale images with the markers printed on a paper. I could upload them if that is useful. (Btw, OpenMVG will crash on grayscale images, so I triplicate the channel to fake an RGB file) |
I have added a repository with sample images to explain the usage of this new exe and the above python script. |
Sidenote: OpenMVG should support grayscale image for only some part of the pipeline. We can try to fix the one where it was not working. |
Yes, regarding grayscale images, I only have problems with the exporters (example OpenMVS), since most of them try to undistort the original images using an I'm not sure what the cleanest way to fix it since the Image class is templated. Probably a generic undistort function which would call ReadImageHeader, then use the appropriate template for Image. In general it would be usefull to check the result of ReadImage to catch errors |
Most of the time I don't even know if some MVS 3rd party tools does even support grayscale image...
Yeah, for sure OpenMVG core is more robust than the exporter. But thanks to the community opensource projects feedbacks and contributions become stronger ;-) |
else | ||
{ | ||
std::cout << "Control Point cannot be triangulated (not in front of the cameras)" << std::endl; | ||
return EXIT_FAILURE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this return
really needed ? Even if THIS point cannot be used, usable data should be extracted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, the number of valid points is already checked just below : if (vec_control_points.size() < 3)
We could simply remove the return
.This is also true where this code originated from: src/software/ui/SfM/control_points_registration/MainWindow.cpp
Hi,
I add the bundle adjustment comment in the code to know when it fails but I'm not able to search deeper. Regards, |
I'm using this code for a school project and I think I've found the issue with the "out_of_range" error. So I've created a function that removes the observation from the sfm_data when this occurs.
and the if statement on line 104 is changed to:
I'm quite new to C++ so I'm sure the function could be written better, but it works. Anyways thanks a lot for this module! |
I was able to repro this problem by having a landmark detected in one image which does not have a valid pose (this image is not connected to the others). There is a crash in Bundle_Adjustment_Ceres because the code iterates over all control points, and tries to access their pose. @Xartos , your fix would work because it removes that pose from all control points, but we could avoid that gymnastics by adding a check directly inside the bundle adjustment, there are already checks for valid intrinsics, there should be checks for a valid pose as well. Specifically this code assumes that the pose is valid:
I suggest we add this same check right before the cost_function calculation.
|
I also added a fix if a control point has no observations at all. |
@pmoulon This pull request to create an additional executable specifically for the Control Point Registration was updated and tested for the current develop branch. Example dataset and usage instructions available at photogrammetry_example_seashell |
Thanks for testing. What you describe is not really an issue, it's a limitation. The aruco panel needs to be printed very precisely, and it also needs to be very flat, otherwise the registration will not work. If printed on paper, I recommend glueing the sheet to a rigid panel to prevent warping. |
Hey, any status update on this? seems like a great feature. Thanks for all the work so far! |
This PR adds a new executable to run Control Point Registration on the command line.
I have simply moved the existing code from ui_openMVG_control_points_registration, which performs the same operation, but from user input.
Having a command line utility for the control point operation is very useful if an exterior tool is providing the control point position in the images, and their corresponding world position.
Here is an example Python code to load an existing SfM file (in json format), read all the images, detect Aruco markers with opencv, then align the scene with this new exe, using desired world position for the markers.