opencv: OpenCV 3.1.0 simple VideoCapture and waitKey crashes after a while on OS X 10.11.2
OpenCV 3.1.0 is installed through brew install opencv3 --with-contirb --with-qt5
and the following program crashes after a while:
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
int main(int argc, const char * argv[]) {
cv::VideoCapture cap(0);
cv::Mat frame;
while (cap.read(frame)) {
imshow("Frame", frame);
if (cv::waitKey(1) == 'q') {
break;
}
}
return 0;
}
The stack trace is the following:
2015-12-24 09:54:22.297 basic-capture[86100:4481590] -[CaptureDelegate doFireTimer:]: unrecognized selector sent to instance 0x103600680
2015-12-24 09:54:22.313 basic-capture[86100:4481590] An uncaught exception was raised
2015-12-24 09:54:22.313 basic-capture[86100:4481590] -[CaptureDelegate doFireTimer:]: unrecognized selector sent to instance 0x103600680
2015-12-24 09:54:22.313 basic-capture[86100:4481590] (
0 CoreFoundation 0x00007fff95766ae2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff90699f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff95769b9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff956a2601 ___forwarding___ + 1009
4 CoreFoundation 0x00007fff956a2188 _CF_forwarding_prep_0 + 120
5 Foundation 0x00007fff9c7d385b __NSFireTimer + 95
6 CoreFoundation 0x00007fff956acbc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
7 CoreFoundation 0x00007fff956ac853 __CFRunLoopDoTimer + 1075
8 CoreFoundation 0x00007fff9572ae6a __CFRunLoopDoTimers + 298
9 CoreFoundation 0x00007fff95667cd1 __CFRunLoopRun + 1841
10 CoreFoundation 0x00007fff95667338 CFRunLoopRunSpecific + 296
11 HIToolbox 0x00007fff8f2f3935 RunCurrentEventLoopInMode + 235
12 HIToolbox 0x00007fff8f2f3677 ReceiveNextEventCommon + 184
13 HIToolbox 0x00007fff8f2f35af _BlockUntilNextEventMatchingListInModeWithFilter + 71
14 AppKit 0x00007fff967d10ee _DPSNextEvent + 1067
15 AppKit 0x00007fff96b9d943 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
16 libqcocoa.dylib 0x000000010555ae5a _ZN21QCocoaEventDispatcher13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE + 1034
17 libopencv_highgui.3.1.dylib 0x000000010083c596 cvWaitKey + 178
18 basic-capture 0x0000000100001666 main + 246
19 libdyld.dylib 0x00007fff8a0335ad start + 1
20 ??? 0x0000000000000001 0x0 + 1
)
2015-12-24 09:54:22.314 basic-capture[86100:4481590] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CaptureDelegate doFireTimer:]: unrecognized selector sent to instance 0x103600680'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff95766ae2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff90699f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff95769b9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff956a2601 ___forwarding___ + 1009
4 CoreFoundation 0x00007fff956a2188 _CF_forwarding_prep_0 + 120
5 Foundation 0x00007fff9c7d385b __NSFireTimer + 95
6 CoreFoundation 0x00007fff956acbc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
7 CoreFoundation 0x00007fff956ac853 __CFRunLoopDoTimer + 1075
8 CoreFoundation 0x00007fff9572ae6a __CFRunLoopDoTimers + 298
9 CoreFoundation 0x00007fff95667cd1 __CFRunLoopRun + 1841
10 CoreFoundation 0x00007fff95667338 CFRunLoopRunSpecific + 296
11 HIToolbox 0x00007fff8f2f3935 RunCurrentEventLoopInMode + 235
12 HIToolbox 0x00007fff8f2f3677 ReceiveNextEventCommon + 184
13 HIToolbox 0x00007fff8f2f35af _BlockUntilNextEventMatchingListInModeWithFilter + 71
14 AppKit 0x00007fff967d10ee _DPSNextEvent + 1067
15 AppKit 0x00007fff96b9d943 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
16 libqcocoa.dylib 0x000000010555ae5a _ZN21QCocoaEventDispatcher13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE + 1034
17 libopencv_highgui.3.1.dylib 0x000000010083c596 cvWaitKey + 178
18 basic-capture 0x0000000100001666 main + 246
19 libdyld.dylib 0x00007fff8a0335ad start + 1
20 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 65 (6 by maintainers)
Commits related to this issue
- opencv3: patch crashing CaptureDevice after 100s patch contains upstream commit https://github.com/Itseez/opencv/commit/a2bda999211e8be9fbc5d40038fdfc9399de31fc which fixes https://github.com/Itseez/... — committed to heinemml/homebrew-science by heinemml 8 years ago
- opencv3: patch crashing CaptureDevice after 100s patch contains upstream commit https://github.com/Itseez/opencv/commit/a2bda999211e8be9fbc5d40038fdfc9399de31fc which fixes https://github.com/Itseez/... — committed to heinemml/homebrew-science by heinemml 8 years ago
yes i was able to fix the crash at 100sec by commenting out the following line
[NSTimer scheduledTimerWithTimeInterval:100 target:capture selector:@selector(doFireTimer:) userInfo:nil repeats:YES];
in the /modules/videoio/src/cap_qtkit.mm file and recompiling
in anaconda prompt, type in:
conda install -c menpo opencv3
according to this website:
https://anaconda.org/menpo/opencv3