Open singinwhale opened 6 years ago
Thank you for yourfeedback.
I tested the scene with default settings on OpenMVG. (The lib used for the SfM backend)
Incremental SfM
Bundle Adjustment statistics (approximated RMSE):
#views: 32
#poses: 32
#intrinsics: 1
#tracks: 68642
#residuals: 502312
Initial RMSE: 0.216791
Final RMSE: 0.195111
Time (s): 4.62626
Global SfM
Bundle Adjustment statistics (approximated RMSE):
#views: 32
#poses: 32
#intrinsics: 1
#tracks: 36297
#residuals: 348902
Initial RMSE: 0.192323
Final RMSE: 0.191442
Time (s): 1.88458
So the error can comes from the provided correspondences that are computed differently in Regard3D.
Thanks @pmoulon for the investigation. I was able to reproduce the crash, however I still don't understand it. It doesn't happen in the triangulation itself, but in the ColorizeTracks function (which is done in Regard3D as part of the triangulation). The call stack is:
Regard3D.exe!Eigen::DenseStorage<unsigned char,3,3,1,0>::DenseStorage<unsigned char,3,3,1,0>(const Eigen::DenseStorage<unsigned char,3,3,1,0> & other) Line 194 C++
Regard3D.exe!Eigen::PlainObjectBase<Eigen::Matrix<unsigned char,3,1,0,3,1> >::PlainObjectBase<Eigen::Matrix<unsigned char,3,1,0,3,1> >(const Eigen::PlainObjectBase<Eigen::Matrix<unsigned char,3,1,0,3,1> > & other) Line 520 C++
Regard3D.exe!Eigen::Matrix<unsigned char,3,1,0,3,1>::Matrix<unsigned char,3,1,0,3,1>(const Eigen::Matrix<unsigned char,3,1,0,3,1> & other) Line 371 C++
[External Code]
> Regard3D.exe!OpenMVGHelper::ColorizeTracks(const openMVG::sfm::SfM_Data & sfm_data, std::vector<Eigen::Matrix<double,3,1,0,3,1>,std::allocator<Eigen::Matrix<double,3,1,0,3,1> > > & vec_3dPoints, std::vector<Eigen::Matrix<double,3,1,0,3,1>,std::allocator<Eigen::Matrix<double,3,1,0,3,1> > > & vec_tracksColor) Line 1904 C++
Regard3D.exe!R3DTriangulationThread::Entry() Line 266 C++
The line in OpenMVGHelper::ColorizeTracks is:
vec_tracksColor[trackIds_to_contiguousIndexes[trackId]] = Vec3(color.r(), color.g(), color.b());
It looks like the constructor of Eigen::Vec3 crashes, but color looks fine:
- color {...} openMVG::image::Rgb<unsigned char>
- Eigen::Matrix<unsigned char,3,1,0,3,1> {...} Eigen::Matrix<unsigned char,3,1,0,3,1>
- Eigen::PlainObjectBase<Eigen::Matrix<unsigned char,3,1,0,3,1> > {m_storage={m_data={array=0x000000000e48f170 "È\x3Ú... } } } Eigen::PlainObjectBase<Eigen::Matrix<unsigned char,3,1,0,3,1> >
+ Eigen::MatrixBase<Eigen::Matrix<unsigned char,3,1,0,3,1> > {...} Eigen::MatrixBase<Eigen::Matrix<unsigned char,3,1,0,3,1> >
- m_storage {m_data={array=0x000000000e48f170 "È\x3Ú... } } Eigen::DenseStorage<unsigned char,3,3,1,0>
- m_data {array=0x000000000e48f170 "È\x3Ú... } Eigen::internal::plain_array<unsigned char,3,0,0>
- array 0x000000000e48f170 "È\x3Ú... unsigned char[3]
[0] 200 'È' unsigned char
[1] 3 '\x3' unsigned char
[2] 218 'Ú' unsigned char
I will continue to investigate.
I found the problem, it is not related to OpenMVG. Regard3D uses OpenCV to load the image, and it rotates the image if the EXIF data say so. That's why the keypoints have the rotated coordinates. In ColorizeTracks however the OpenMVG method is used to load the image, which does not rotate, and then the line
const openMVG::image::RGBColor color = image(pt.y(), pt.x());
leads to the crash.
I will set the flag IMREAD_IGNORE_ORIENTATION such that OpenCV will not rotate the image.
I get an access violation when I work with the Agisoft Sample Data (link). I have a fresh install of 9.2 on Windows 10 and left all settings as default. I just imported the images and went through the steps. It crashes halfway through the Triangulation step. Here is a Visual Studio 2015 dump if you need it. Stacktrace: -> Regard3D.exe!00007ff6668a4219()
Regard3D.exe!00007ff666896e85() Regard3D.exe!00007ff666aa8060() Regard3D.exe!00007ff666aa97e2() Regard3D.exe!00007ff666aa951f()