Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

AVCaptureVideoDataOutput motion detection crash

I'll try to implement motion detection from AVCaptureVideoDataOutput: Firstly CMSampleBufferRef converted in Mat. Then i use code from motempl for detecting motion. But when i call function from background thread i got error in cvtColor() or segmentMotion():

Thread 11: EXC_BAD_ACCESS

or sometimes in calcMotionGradient():

Error: Assertion failed (dims <= 2 && step[0] > 0) in locateROI, file /Users/john/Downloads/opencv-3.4.1/modules/core/src/matrix.cpp, line 760

In main thread it's works, but freeze UI queue. Motion detector class code. What did I do wrong?