MasteringOpenCV / code

Code for the book "Mastering OpenCV with Practical Computer Vision Projects" by Packt Publishing 2012.
Other
2.73k stars 1.65k forks source link

Chapter 4 Crash on OSX #45

Open wolfgangfoulkes opened 9 years ago

wolfgangfoulkes commented 9 years ago

I build the example in Chapter 4 on my machine running OSX Mavericks. My images were rather large, and high-def (from iPhone camera) There were 20-30 of them. I built the Debug version of the project in XCode. After image files were loaded, and either after or during feature-detection and matching(I may be wrong about this, but it did not get to printing P and E matrices), the process froze and nearly crashed my computer after printing this error message:

2014-11-01 01:14:19.000 ExploringSFMExec[50530:1f03] * Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1056.16/Misc.subproj/NSUndoManager.m:328 2014-11-01 01:14:22.919 ExploringSFMExec[50530:1f03] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 2014-11-01 01:14:33.248 ExploringSFMExec[50530:1f03](0 CoreFoundation 0x00007fff929a025c __exceptionPreprocess + 172 1 libobjc.A.dylib 0x00007fff8dfb5e75 objc_exception_throw + 43 2 CoreFoundation 0x00007fff929a0038 +[NSException raise:format:arguments:] + 104 3 Foundation 0x00007fff9155f3d1 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189 4 Foundation 0x00007fff914c991c +[NSUndoManager%28NSPrivate%29 _endTopLevelGroupings] + 156 5 AppKit 0x00007fff98923a23 -[NSApplication run] + 688 6 libpcl_visualization.1.7.dylib 0x000000010fd6ffae _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 280 7 ExploringSFMExec 0x00000001071d6954 _Z20RunVisualizationOnlyv + 5044 8 ExploringSFMExec 0x00000001071f4bf6 _ZN5boost6detail11thread_dataIPFvvEE3runEv + 22 9 libboost_thread-mt.dylib 0x00000001080b2d05 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 133 10 libsystem_pthread.dylib 0x00007fff90699899 _pthread_body + 138 11 libsystem_pthread.dylib 0x00007fff9069972a _pthread_struct_init + 0 12 libsystem_pthread.dylib 0x00007fff9069dfc9 thread_start + 13) 2014-11-01 01:14:34.049 ExploringSFMExec[50530:1f03] * Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1056.16/Misc.subproj/NSUndoManager.m:328 2014-11-01 01:14:34.280 ExploringSFMExec[50530:1f03] An uncaught exception was raised 2014-11-01 01:14:34.783 ExploringSFMExec[50530:1f03] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 2014-11-01 01:14:34.784 ExploringSFMExec[50530:1f03](0 CoreFoundation 0x00007fff929a025c exceptionPreprocess + 172 1 libobjc.A.dylib 0x00007fff8dfb5e75 objc_exception_throw + 43 2 CoreFoundation 0x00007fff929a0038 +[NSException raise:format:arguments:] + 104 3 Foundation 0x00007fff9155f3d1 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189 4 Foundation 0x00007fff914c991c +[NSUndoManager%28NSPrivate%29 _endTopLevelGroupings] + 156 5 AppKit 0x00007fff98923acd -[NSApplication run] + 858 6 libpcl_visualization.1.7.dylib 0x000000010fd6ffae _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 280 7 ExploringSFMExec 0x00000001071d6954 _Z20RunVisualizationOnlyv + 5044 8 ExploringSFMExec 0x00000001071f4bf6 _ZN5boost6detail11thread_dataIPFvvEE3runEv + 22 9 libboost_thread-mt.dylib 0x00000001080b2d05 _ZN5boost12_GLOBALN_112thread_proxyEPv + 133 10 libsystem_pthread.dylib 0x00007fff90699899 _pthread_body + 138 11 libsystem_pthread.dylib 0x00007fff9069972a _pthread_struct_init + 0 12 libsystem_pthread.dylib 0x00007fff9069dfc9 thread_start + 13) 2014-11-01 01:14:34.896 ExploringSFMExec[50530:1f03] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.' * First throw call stack: ( 0 CoreFoundation 0x00007fff929a025c exceptionPreprocess + 172 1 libobjc.A.dylib 0x00007fff8dfb5e75 objc_exception_throw + 43 2 CoreFoundation 0x00007fff929a0038 +[NSException raise:format:arguments:] + 104 3 Foundation 0x00007fff9155f3d1 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189 4 Foundation 0x00007fff914c991c +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156 5 AppKit 0x00007fff98923acd -[NSApplication run] + 858 6 libpcl_visualization.1.7.dylib 0x000000010fd6ffae _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 280 7 ExploringSFMExec 0x00000001071d6954 _Z20RunVisualizationOnlyv + 5044 8 ExploringSFMExec 0x00000001071f4bf6 _ZN5boost6detail11thread_dataIPFvvEE3runEv + 22 9 libboost_thread-mt.dylib 0x00000001080b2d05 _ZN5boost12_GLOBALN_112thread_proxyEPv + 133 10 libsystem_pthread.dylib 0x00007fff90699899 _pthread_body + 138 11 libsystem_pthread.dylib 0x00007fff9069972a _pthread_struct_init + 0 12 libsystem_pthread.dylib 0x00007fff9069dfc9 thread_start + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException

( In addition to this issue, I have a few more questions about this chapter's code, which might be very useful to my undergraduate thesis project if I can figure out a few details that aren't covered in the book. Is there a better place to contact you? )

orgicus commented 8 years ago

Very similar on OSX 10.11:

=========================== Load Images ===========================
..........................................................................................................................................................................................................................................................
 -------------------- extract feature points for all images -------------------
2016-06-21 21:58:06.416 ExploringSfMExec[87255:994801] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-06-21 21:58:06.417 ExploringSfMExec[87255:994801] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-06-21 21:58:06.419 ExploringSfMExec[87255:994801] (
    0   CoreFoundation                      0x00007fff8c4764f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff95441f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff8c47b1ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9a60b856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   Foundation                          0x00007fff9a590af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
    5   AppKit                              0x00007fff8b347e22 -[NSApplication run] + 844
    6   libpcl_visualization.1.8.dylib      0x000000010b530468 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 310
    7   ExploringSfMExec                    0x0000000105fd420e _Z20RunVisualizationOnlyv + 4974
    8   ExploringSfMExec                    0x0000000105ff14e6 _ZN5boost6detail11thread_dataIPFvvEE3runEv + 22
    9   libboost_thread-mt.dylib            0x0000000106362804 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 164
    10  libsystem_pthread.dylib             0x00007fff85b7799d _pthread_body + 131
    11  libsystem_pthread.dylib             0x00007fff85b7791a _pthread_body + 0
    12  libsystem_pthread.dylib             0x00007fff85b75351 thread_start + 13
)
2016-06-21 21:58:06.420 ExploringSfMExec[87255:994801] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-06-21 21:58:06.420 ExploringSfMExec[87255:994801] An uncaught exception was raised
2016-06-21 21:58:06.420 ExploringSfMExec[87255:994801] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-06-21 21:58:06.420 ExploringSfMExec[87255:994801] (
    0   CoreFoundation                      0x00007fff8c4764f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff95441f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff8c47b1ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9a60b856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   Foundation                          0x00007fff9a590af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
    5   AppKit                              0x00007fff8b347ebe -[NSApplication run] + 1000
    6   libpcl_visualization.1.8.dylib      0x000000010b530468 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 310
    7   ExploringSfMExec                    0x0000000105fd420e _Z20RunVisualizationOnlyv + 4974
    8   ExploringSfMExec                    0x0000000105ff14e6 _ZN5boost6detail11thread_dataIPFvvEE3runEv + 22
    9   libboost_thread-mt.dylib            0x0000000106362804 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 164
    10  libsystem_pthread.dylib             0x00007fff85b7799d _pthread_body + 131
    11  libsystem_pthread.dylib             0x00007fff85b7791a _pthread_body + 0
    12  libsystem_pthread.dylib             0x00007fff85b75351 thread_start + 13
)
2016-06-21 21:58:06.420 ExploringSfMExec[87255:994801] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8c4764f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff95441f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff8c47b1ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9a60b856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   Foundation                          0x00007fff9a590af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
    5   AppKit                              0x00007fff8b347ebe -[NSApplication run] + 1000
    6   libpcl_visualization.1.8.dylib      0x000000010b530468 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 310
    7   ExploringSfMExec                    0x0000000105fd420e _Z20RunVisualizationOnlyv + 4974
    8   ExploringSfMExec                    0x0000000105ff14e6 _ZN5boost6detail11thread_dataIPFvvEE3runEv + 22
    9   libboost_thread-mt.dylib            0x0000000106362804 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 164
    10  libsystem_pthread.dylib             0x00007fff85b7799d _pthread_body + 131
    11  libsystem_pthread.dylib             0x00007fff85b7791a _pthread_body + 0
    12  libsystem_pthread.dylib             0x00007fff85b75351 thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
royshil commented 8 years ago

We are in the process of re-writing this chapter's code, which should eliminate many of the compilation and runtime errors you experience.