Closed orgicus closed 3 years ago
@orgicus I'm refactoring the library and very soon will come out with a new version using OpenCV 3
The work in progress is on a branch called opencv3
It heavily simplifies things aiming for a much more readable code, and less compilation mess.
Thank you, I'll give the opencv3
branch a go soon ! :)
I've just tried the opencv3
branch but got errors on this one too:
Scanning dependencies of target SfMToyUI_automoc
[ 11%] Automatic moc and uic for target SfMToyUI
Generating moc source SfMToyUI_automoc.dir/moc_sfmviewer.cpp
Generating moc compilation SfMToyUI_automoc.cpp
Generating ui header ui_sfmtoy.h
[ 11%] Built target SfMToyUI_automoc
Scanning dependencies of target SfMToyLibrary
[ 22%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o
/Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/SfMToyLib/SfM.cpp:55:29: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
for (directory_entry& x : directory_iterator(dirPath)) {
^
/Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/SfMToyLib/SfM.cpp:69:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
for (auto& imageFilename : mImageFilenames) {
^
/Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/SfMToyLib/SfM.cpp:69:30: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
for (auto& imageFilename : mImageFilenames) {
^
3 warnings generated.
[ 33%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM2DFeatureUtilities.cpp.o
[ 44%] Linking CXX static library libSfMToyLibrary.a
[ 44%] Built target SfMToyLibrary
Scanning dependencies of target SfMToyUI
[ 55%] Building CXX object CMakeFiles/SfMToyUI.dir/ViewerInterface.cpp.o
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:45:1: error: unknown type name 'Q_DECL_CONST_FUNCTION'
Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_NOTHROW;
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:45:23: error: expected unqualified-id
Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_NOTHROW;
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:47:24: error: variable has incomplete type 'class Q_WIDGETS_EXPORT'
class Q_WIDGETS_EXPORT QSizePolicy
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:47:7: note: forward declaration of 'Q_WIDGETS_EXPORT'
class Q_WIDGETS_EXPORT QSizePolicy
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:47:35: error: expected ';' after top level declarator
class Q_WIDGETS_EXPORT QSizePolicy
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2471:32: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2471:60: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2471:81: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2472:17: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
{ return QFlags<Flags::enum_type>(f1) | f2; } \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2473:32: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2473:60: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2473:88: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:161:31: error: incomplete type 'QSizePolicy' named in nested name specifier
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2474:50: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
^
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2467:36: note: expanded from macro 'Q_DECLARE_INCOMPATIBLE_FLAGS'
inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) \
^
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.cpp:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/ViewerInterface.h:30:
In file included from /Users/George/Downloads/Libraries/SfM-Toy-Library-OpenCV3/build/ui_sfmtoy.h:13:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/QAction:1:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qaction.h:39:
In file included from /usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qwidget.h:45:
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:164:18: error: variable has incomplete type 'Q_WIDGETS_EXPORT'
Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:47:7: note: forward declaration of 'Q_WIDGETS_EXPORT'
class Q_WIDGETS_EXPORT QSizePolicy
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:164:29: error: expected ';' after top level declarator
Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:165:18: error: redefinition of 'QDataStream'
Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:164:18: note: previous definition is here
Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:165:29: error: expected ';' after top level declarator
Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:169:18: error: variable has incomplete type 'Q_WIDGETS_EXPORT'
Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &);
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:47:7: note: forward declaration of 'Q_WIDGETS_EXPORT'
class Q_WIDGETS_EXPORT QSizePolicy
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:169:24: error: expected ';' after top level declarator
Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &);
^
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qsizepolicy.h:172:13: error: incomplete type 'QSizePolicy' named in nested name specifier
inline void QSizePolicy::transpose() {
^~~~~~~~~~~~~
/usr/local/lib/QtCore.framework/Headers/qmetatype.h:330:7: note: forward declaration of 'QSizePolicy'
class QSizePolicy;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/SfMToyUI.dir/ViewerInterface.cpp.o] Error 1
make[1]: *** [CMakeFiles/SfMToyUI.dir/all] Error 2
make: *** [all] Error 2
I think will just wait for the opencv3
branch to be ready/merged.
Meanwhile if there are any tests I could run that might help please let me know.
Thank you, George
@orgicus Yes the branch is in progress at the moment. Not yet functional. But I'm making progress and will push another big update in the next week or so.
@royshil Thank you for posting updates. Just wanted to let you know what the outcome with my setup currently is.
After pulling your latest code from the opencv3 branch I still get the same Qt errors. The fact that I have two qt5 installs might have something to with it:
I've also tried uninstall homebrew qt and reinstalling Qt (versions 5.0.2,5.1.0,5.1.1,5.2.0,5.2.1,5.4,5.5,5.6,5.7) using the official installer, but no joy.
The strange thing is I got the exact same errors with either versions. Would you happen to have a .pro Qt Creator file for this project ?
Additionally, the project compiles and runs if I set USE_GUI=OFF
and USE_QT=OFF
.
I've used the crazyhorse
dataset but it looks the result wasn't great:
./SfMToyUI ../dataset/crazyhorse
Found 7 image files in directory.
----------------- Extract Features -----------------
Image 0: 2000 keypoints
Image 1: 2000 keypoints
Image 2: 2000 keypoints
Image 3: 2000 keypoints
Image 4: 2000 keypoints
Image 5: 2000 keypoints
Image 6: 2000 keypoints
----------- Create Feature Match Matrix ------------
Match 0, 1: 348 matched features
Match 0, 2: 220 matched features
Match 0, 3: 169 matched features
Match 0, 4: 117 matched features
Match 0, 5: 97 matched features
Match 0, 6: 86 matched features
Match 1, 2: 289 matched features
Match 1, 3: 196 matched features
Match 1, 4: 152 matched features
Match 1, 5: 132 matched features
Match 1, 6: 99 matched features
Match 2, 3: 202 matched features
Match 2, 4: 160 matched features
Match 2, 5: 116 matched features
Match 2, 6: 103 matched features
Match 3, 4: 191 matched features
Match 3, 5: 160 matched features
Match 3, 6: 141 matched features
Match 4, 5: 184 matched features
Match 4, 6: 167 matched features
Match 5, 6: 228 matched features
----------- Find Baseline Triangulation ------------
--- Sort views by homography inliers
---------- Find Views Homography Inliers -----------
Homography inliers ratio: 0, 1 0.505747
Homography inliers ratio: 0, 2 0.381818
Homography inliers ratio: 0, 3 0.331361
Homography inliers ratio: 0, 4 0.25641
Homography inliers ratio: 1, 2 0.50519
Homography inliers ratio: 1, 3 0.346939
Homography inliers ratio: 1, 4 0.289474
Homography inliers ratio: 1, 5 0.295455
Homography inliers ratio: 2, 3 0.519802
Homography inliers ratio: 2, 4 0.3375
Homography inliers ratio: 2, 5 0.301724
Homography inliers ratio: 2, 6 0.281553
Homography inliers ratio: 3, 4 0.471204
Homography inliers ratio: 3, 5 0.36875
Homography inliers ratio: 3, 6 0.29078
Homography inliers ratio: 4, 5 0.380435
Homography inliers ratio: 4, 6 0.323353
Homography inliers ratio: 5, 6 0.491228
--- Try views in triangulation
Trying [0, 4] ratio: 0.25641
---- Find camera matrices
pose inliers ratio 0.512821
---- Triangulate from stereo views
Solver Summary (v 1.11.0-eigen-(3.2.8)-lapack-suitesparse-(4.4.4)-cxsparse-(3.1.4)-no_openmp)
Original Reduced
Parameter blocks 94 94
Parameters 294 294
Residual blocks 184 184
Residual 368 368
Minimizer TRUST_REGION
Dense linear algebra library EIGEN
Trust region strategy LEVENBERG_MARQUARDT
Given Used
Linear solver DENSE_SCHUR DENSE_SCHUR
Threads 1 1
Linear solver threads 1 1
Linear solver ordering AUTOMATIC 92, 2
Cost:
Initial 4.181496e+07
Final 1.389629e+02
Change 4.181482e+07
Minimizer iterations 50
Successful steps 42
Unsuccessful steps 8
Time (in seconds):
Preprocessor 0.0067
Residual evaluation 0.0012
Jacobian evaluation 0.6798
Linear solver 0.0082
Minimizer 0.6908
Postprocessor 0.0000
Total 0.6975
Termination: NO_CONVERGENCE (Maximum number of iterations reached.)
----------------- Add More Views ------------------
Best view 1 has 152 matches
Inliers ratio is too small: 41 / 152
Cannot recover camera pose for view 1
Best view 2 has 134 matches
Inliers ratio is too small: 41 / 134
Cannot recover camera pose for view 2
Best view 3 has 128 matches
Inliers ratio is too small: 39 / 128
Cannot recover camera pose for view 3
Best view 5 has 103 matches
Inliers ratio is too small: 33 / 103
Cannot recover camera pose for view 5
Best view 6 has 90 matches
Inliers ratio is too small: 25 / 90
Cannot recover camera pose for view 6
Is this expected ?
@orgicus Only the command line interface is working at the moment in this branch. I will recreate the GUI when this is done. I'm still debugging an issue with the Ceres bundle adjuster. This is the reason the reconstruction fails. Keep track for more updates soon
Closing this as Chapter 2 in Mastering OpenCV 4 provides an updated solution
I've installed dependencies using brew and tried to compile but got stuck here:
if I disable QT/GUI I get a different error:
Any tips/hints ?